From 87af7f96fc7744b098e293fa382ea1ae9780cb6a Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 14 Oct 2020 12:16:12 +0200 Subject: [PATCH 001/156] add DOI badge --- README.md | 4 + node_modules/.bin/atob | 1 + node_modules/.bin/esparse | 1 + node_modules/.bin/esvalidate | 1 + node_modules/.bin/js-yaml | 1 + node_modules/.bin/json5 | 1 + node_modules/.bin/rc | 1 + node_modules/.bin/remark | 1 + node_modules/@types/unist/LICENSE | 21 + node_modules/@types/unist/README.md | 16 + node_modules/@types/unist/index.d.ts | 98 + node_modules/@types/unist/package.json | 96 + node_modules/ansi-regex/index.js | 4 + node_modules/ansi-regex/license | 21 + node_modules/ansi-regex/package.json | 108 + node_modules/ansi-regex/readme.md | 39 + 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 | 98 + node_modules/anymatch/index.js | 67 + node_modules/anymatch/package.json | 72 + node_modules/argparse/CHANGELOG.md | 185 + node_modules/argparse/LICENSE | 21 + node_modules/argparse/README.md | 257 + node_modules/argparse/index.js | 3 + node_modules/argparse/lib/action.js | 146 + node_modules/argparse/lib/action/append.js | 53 + .../argparse/lib/action/append/constant.js | 47 + node_modules/argparse/lib/action/count.js | 40 + node_modules/argparse/lib/action/help.js | 47 + node_modules/argparse/lib/action/store.js | 50 + .../argparse/lib/action/store/constant.js | 43 + .../argparse/lib/action/store/false.js | 27 + .../argparse/lib/action/store/true.js | 26 + .../argparse/lib/action/subparsers.js | 149 + node_modules/argparse/lib/action/version.js | 47 + node_modules/argparse/lib/action_container.js | 482 ++ node_modules/argparse/lib/argparse.js | 14 + node_modules/argparse/lib/argument/error.js | 50 + .../argparse/lib/argument/exclusive.js | 54 + node_modules/argparse/lib/argument/group.js | 75 + node_modules/argparse/lib/argument_parser.js | 1161 +++ node_modules/argparse/lib/const.js | 21 + .../argparse/lib/help/added_formatters.js | 87 + node_modules/argparse/lib/help/formatter.js | 795 ++ node_modules/argparse/lib/namespace.js | 76 + node_modules/argparse/lib/utils.js | 57 + node_modules/argparse/package.json | 70 + node_modules/arr-diff/LICENSE | 21 + node_modules/arr-diff/README.md | 74 + node_modules/arr-diff/index.js | 58 + node_modules/arr-diff/package.json | 80 + 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 | 114 + 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-unique/LICENSE | 21 + node_modules/array-unique/README.md | 51 + node_modules/array-unique/index.js | 28 + node_modules/array-unique/package.json | 62 + 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/README.md | 52 + node_modules/async-each/index.js | 38 + node_modules/async-each/package.json | 63 + node_modules/atob/LICENSE | 230 + node_modules/atob/LICENSE.DOCS | 319 + node_modules/atob/README.md | 49 + node_modules/atob/bin/atob.js | 6 + node_modules/atob/bower.json | 24 + node_modules/atob/browser-atob.js | 44 + node_modules/atob/node-atob.js | 7 + node_modules/atob/package.json | 53 + node_modules/atob/test.js | 18 + node_modules/bail/index.js | 9 + node_modules/bail/license | 22 + node_modules/bail/package.json | 111 + node_modules/bail/readme.md | 84 + 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 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 144 + .../is-accessor-descriptor/index.js | 69 + .../is-accessor-descriptor/package.json | 110 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 161 + .../node_modules/is-data-descriptor/index.js | 49 + .../is-data-descriptor/package.json | 109 + .../base/node_modules/is-descriptor/LICENSE | 21 + .../base/node_modules/is-descriptor/README.md | 193 + .../base/node_modules/is-descriptor/index.js | 22 + .../node_modules/is-descriptor/package.json | 114 + .../base/node_modules/isobject/LICENSE | 21 + .../base/node_modules/isobject/README.md | 122 + .../base/node_modules/isobject/index.d.ts | 5 + .../base/node_modules/isobject/index.js | 12 + .../base/node_modules/isobject/package.json | 119 + .../base/node_modules/kind-of/CHANGELOG.md | 160 + .../base/node_modules/kind-of/LICENSE | 21 + .../base/node_modules/kind-of/README.md | 367 + .../base/node_modules/kind-of/index.js | 129 + .../base/node_modules/kind-of/package.json | 145 + node_modules/base/package.json | 162 + .../binary-extensions/binary-extensions.json | 252 + node_modules/binary-extensions/license | 9 + node_modules/binary-extensions/package.json | 68 + node_modules/binary-extensions/readme.md | 33 + node_modules/bindings/LICENSE.md | 22 + node_modules/bindings/README.md | 98 + node_modules/bindings/bindings.js | 221 + node_modules/bindings/package.json | 57 + 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 | 248 + node_modules/braces/index.js | 399 + node_modules/braces/package.json | 114 + node_modules/buffer-from/LICENSE | 21 + node_modules/buffer-from/index.js | 69 + node_modules/buffer-from/package.json | 52 + node_modules/buffer-from/readme.md | 69 + node_modules/cache-base/LICENSE | 21 + node_modules/cache-base/README.md | 291 + node_modules/cache-base/index.js | 261 + .../cache-base/node_modules/isobject/LICENSE | 21 + .../node_modules/isobject/README.md | 122 + .../node_modules/isobject/index.d.ts | 5 + .../cache-base/node_modules/isobject/index.js | 12 + .../node_modules/isobject/package.json | 119 + node_modules/cache-base/package.json | 118 + node_modules/camelcase/index.js | 64 + node_modules/camelcase/license | 21 + node_modules/camelcase/package.json | 74 + node_modules/camelcase/readme.md | 57 + node_modules/ccount/index.js | 22 + node_modules/ccount/license | 22 + node_modules/ccount/package.json | 109 + node_modules/ccount/readme.md | 68 + node_modules/chalk/index.js | 228 + node_modules/chalk/index.js.flow | 93 + node_modules/chalk/license | 9 + node_modules/chalk/package.json | 103 + node_modules/chalk/readme.md | 314 + node_modules/chalk/templates.js | 128 + node_modules/chalk/types/index.d.ts | 97 + .../character-entities-html4/index.json | 254 + node_modules/character-entities-html4/license | 22 + .../character-entities-html4/package.json | 110 + .../character-entities-html4/readme.md | 73 + .../character-entities-legacy/index.json | 108 + .../character-entities-legacy/license | 22 + .../character-entities-legacy/package.json | 110 + .../character-entities-legacy/readme.md | 74 + node_modules/character-entities/index.json | 2224 ++++++ node_modules/character-entities/license | 22 + node_modules/character-entities/package.json | 110 + node_modules/character-entities/readme.md | 72 + .../character-reference-invalid/index.json | 30 + .../character-reference-invalid/license | 22 + .../character-reference-invalid/package.json | 113 + .../character-reference-invalid/readme.md | 74 + node_modules/chokidar/CHANGELOG.md | 274 + node_modules/chokidar/README.md | 293 + node_modules/chokidar/index.js | 716 ++ node_modules/chokidar/lib/fsevents-handler.js | 397 + node_modules/chokidar/lib/nodefs-handler.js | 481 ++ node_modules/chokidar/package.json | 84 + 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 + .../class-utils/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 | 119 + node_modules/class-utils/package.json | 131 + node_modules/co/Readme.md | 371 + node_modules/co/index.js | 294 + node_modules/co/package.json | 60 + node_modules/code-point-at/index.js | 32 + node_modules/code-point-at/license | 21 + node_modules/code-point-at/package.json | 70 + node_modules/code-point-at/readme.md | 32 + node_modules/collapse-white-space/index.js | 8 + node_modules/collapse-white-space/license | 22 + .../collapse-white-space/package.json | 110 + node_modules/collapse-white-space/readme.md | 58 + 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 | 868 +++ 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/component-emitter/History.md | 75 + node_modules/component-emitter/LICENSE | 24 + node_modules/component-emitter/Readme.md | 74 + node_modules/component-emitter/index.js | 175 + 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/concat-stream/LICENSE | 24 + node_modules/concat-stream/index.js | 144 + node_modules/concat-stream/package.json | 84 + node_modules/concat-stream/readme.md | 102 + node_modules/copy-descriptor/LICENSE | 21 + node_modules/copy-descriptor/index.js | 81 + node_modules/copy-descriptor/package.json | 87 + 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/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 | 89 + 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/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 | 46 + node_modules/deep-extend/LICENSE | 20 + node_modules/deep-extend/README.md | 91 + node_modules/deep-extend/index.js | 1 + node_modules/deep-extend/lib/deep-extend.js | 150 + node_modules/deep-extend/package.json | 92 + 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 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 144 + .../is-accessor-descriptor/index.js | 69 + .../is-accessor-descriptor/package.json | 110 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 161 + .../node_modules/is-data-descriptor/index.js | 49 + .../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/is-descriptor/package.json | 114 + .../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 | 119 + .../node_modules/kind-of/CHANGELOG.md | 160 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 367 + .../node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 145 + node_modules/define-property/package.json | 106 + node_modules/error-ex/LICENSE | 21 + node_modules/error-ex/README.md | 144 + node_modules/error-ex/index.js | 141 + node_modules/error-ex/package.json | 86 + 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/esprima/ChangeLog | 235 + node_modules/esprima/LICENSE.BSD | 21 + node_modules/esprima/README.md | 46 + node_modules/esprima/bin/esparse.js | 139 + node_modules/esprima/bin/esvalidate.js | 236 + node_modules/esprima/dist/esprima.js | 6709 +++++++++++++++++ node_modules/esprima/package.json | 137 + node_modules/expand-brackets/LICENSE | 21 + node_modules/expand-brackets/README.md | 107 + node_modules/expand-brackets/index.js | 163 + node_modules/expand-brackets/package.json | 93 + node_modules/expand-range/LICENSE | 24 + node_modules/expand-range/README.md | 145 + node_modules/expand-range/index.js | 43 + node_modules/expand-range/package.json | 104 + 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/extend/.editorconfig | 20 + node_modules/extend/.eslintrc | 17 + node_modules/extend/.jscs.json | 175 + node_modules/extend/.travis.yml | 230 + node_modules/extend/CHANGELOG.md | 83 + node_modules/extend/LICENSE | 23 + node_modules/extend/README.md | 81 + node_modules/extend/component.json | 32 + node_modules/extend/index.js | 117 + node_modules/extend/package.json | 75 + node_modules/extglob/LICENSE | 21 + node_modules/extglob/README.md | 88 + node_modules/extglob/index.js | 178 + node_modules/extglob/package.json | 85 + node_modules/fault/index.js | 31 + node_modules/fault/license | 22 + node_modules/fault/package.json | 118 + node_modules/fault/readme.md | 138 + node_modules/file-uri-to-path/.npmignore | 1 + node_modules/file-uri-to-path/.travis.yml | 30 + node_modules/file-uri-to-path/History.md | 21 + node_modules/file-uri-to-path/LICENSE | 20 + node_modules/file-uri-to-path/README.md | 74 + node_modules/file-uri-to-path/index.d.ts | 2 + node_modules/file-uri-to-path/index.js | 66 + node_modules/file-uri-to-path/package.json | 61 + node_modules/file-uri-to-path/test/test.js | 24 + node_modules/file-uri-to-path/test/tests.json | 13 + node_modules/filename-regex/LICENSE | 21 + node_modules/filename-regex/README.md | 63 + node_modules/filename-regex/index.js | 10 + node_modules/filename-regex/package.json | 81 + node_modules/fill-range/LICENSE | 21 + node_modules/fill-range/README.md | 317 + node_modules/fill-range/index.js | 408 + node_modules/fill-range/package.json | 109 + node_modules/fn-name/index.js | 8 + node_modules/fn-name/license | 21 + node_modules/fn-name/package.json | 62 + node_modules/fn-name/readme.md | 26 + 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 | 107 + node_modules/for-own/LICENSE | 21 + node_modules/for-own/README.md | 85 + node_modules/for-own/index.js | 19 + node_modules/for-own/package.json | 109 + node_modules/format/.npmignore | 1 + node_modules/format/Makefile | 13 + node_modules/format/Readme.md | 46 + node_modules/format/component.json | 9 + node_modules/format/format-min.js | 2 + node_modules/format/format.js | 128 + node_modules/format/package.json | 55 + node_modules/format/test_format.js | 54 + 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/fs.realpath/LICENSE | 43 + node_modules/fs.realpath/README.md | 33 + node_modules/fs.realpath/index.js | 66 + node_modules/fs.realpath/old.js | 303 + node_modules/fs.realpath/package.json | 59 + node_modules/get-value/LICENSE | 21 + node_modules/get-value/index.js | 50 + node_modules/get-value/package.json | 113 + node_modules/glob-base/LICENSE | 21 + node_modules/glob-base/README.md | 158 + node_modules/glob-base/index.js | 51 + node_modules/glob-base/package.json | 77 + node_modules/glob-parent/.npmignore | 4 + node_modules/glob-parent/.travis.yml | 8 + node_modules/glob-parent/LICENSE | 15 + node_modules/glob-parent/README.md | 43 + node_modules/glob-parent/index.js | 10 + node_modules/glob-parent/package.json | 63 + node_modules/glob-parent/test.js | 28 + node_modules/glob/LICENSE | 21 + node_modules/glob/README.md | 375 + node_modules/glob/changelog.md | 67 + node_modules/glob/common.js | 240 + node_modules/glob/glob.js | 790 ++ node_modules/glob/package.json | 79 + node_modules/glob/sync.js | 486 ++ node_modules/graceful-fs/LICENSE | 15 + node_modules/graceful-fs/README.md | 133 + node_modules/graceful-fs/clone.js | 19 + node_modules/graceful-fs/graceful-fs.js | 354 + node_modules/graceful-fs/legacy-streams.js | 118 + node_modules/graceful-fs/package.json | 79 + node_modules/graceful-fs/polyfills.js | 342 + 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 + .../has-value/node_modules/isobject/LICENSE | 21 + .../has-value/node_modules/isobject/README.md | 122 + .../node_modules/isobject/index.d.ts | 5 + .../has-value/node_modules/isobject/index.js | 12 + .../node_modules/isobject/package.json | 119 + 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/is-number/LICENSE | 21 + .../node_modules/is-number/README.md | 115 + .../node_modules/is-number/index.js | 22 + .../is-number/node_modules/kind-of/LICENSE | 21 + .../is-number/node_modules/kind-of/README.md | 261 + .../is-number/node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../node_modules/is-number/package.json | 123 + .../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/ignore/README.md | 262 + node_modules/ignore/ignore.js | 425 ++ node_modules/ignore/index.d.ts | 41 + node_modules/ignore/package.json | 84 + node_modules/inflight/LICENSE | 15 + node_modules/inflight/README.md | 37 + node_modules/inflight/inflight.js | 54 + node_modules/inflight/package.json | 58 + node_modules/inherits/LICENSE | 16 + node_modules/inherits/README.md | 42 + node_modules/inherits/inherits.js | 9 + node_modules/inherits/inherits_browser.js | 27 + node_modules/inherits/package.json | 65 + node_modules/ini/LICENSE | 15 + node_modules/ini/README.md | 102 + node_modules/ini/ini.js | 194 + node_modules/ini/package.json | 63 + node_modules/irregular-plurals/index.js | 15 + .../irregular-plurals/irregular-plurals.json | 146 + node_modules/irregular-plurals/license | 9 + node_modules/irregular-plurals/package.json | 71 + node_modules/irregular-plurals/readme.md | 47 + node_modules/is-accessor-descriptor/LICENSE | 21 + node_modules/is-accessor-descriptor/README.md | 123 + node_modules/is-accessor-descriptor/index.js | 69 + .../is-accessor-descriptor/package.json | 92 + node_modules/is-alphabetical/index.js | 14 + node_modules/is-alphabetical/license | 22 + node_modules/is-alphabetical/package.json | 115 + node_modules/is-alphabetical/readme.md | 70 + node_modules/is-alphanumeric/index.js | 8 + node_modules/is-alphanumeric/license | 21 + node_modules/is-alphanumeric/package.json | 73 + node_modules/is-alphanumeric/readme.md | 40 + node_modules/is-alphanumerical/index.js | 12 + node_modules/is-alphanumerical/license | 22 + node_modules/is-alphanumerical/package.json | 117 + node_modules/is-alphanumerical/readme.md | 71 + node_modules/is-arrayish/.editorconfig | 18 + node_modules/is-arrayish/.istanbul.yml | 4 + node_modules/is-arrayish/.npmignore | 5 + node_modules/is-arrayish/.travis.yml | 17 + node_modules/is-arrayish/LICENSE | 21 + node_modules/is-arrayish/README.md | 16 + node_modules/is-arrayish/index.js | 10 + node_modules/is-arrayish/package.json | 66 + 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 | 84 + node_modules/is-buffer/test/basic.js | 24 + 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/is-data-descriptor/package.json | 91 + node_modules/is-decimal/index.js | 11 + node_modules/is-decimal/license | 22 + node_modules/is-decimal/package.json | 114 + node_modules/is-decimal/readme.md | 69 + 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 | 117 + node_modules/is-dotfile/LICENSE | 21 + node_modules/is-dotfile/README.md | 95 + node_modules/is-dotfile/index.js | 14 + node_modules/is-dotfile/package.json | 106 + node_modules/is-empty/.npmignore | 1 + node_modules/is-empty/.travis.yml | 4 + node_modules/is-empty/History.md | 24 + node_modules/is-empty/Readme.md | 49 + node_modules/is-empty/lib/index.js | 79 + node_modules/is-empty/package.json | 58 + node_modules/is-equal-shallow/LICENSE | 21 + node_modules/is-equal-shallow/README.md | 90 + node_modules/is-equal-shallow/index.js | 27 + node_modules/is-equal-shallow/package.json | 85 + 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 | 90 + node_modules/is-extglob/LICENSE | 21 + node_modules/is-extglob/README.md | 75 + node_modules/is-extglob/index.js | 11 + node_modules/is-extglob/package.json | 79 + 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 | 105 + node_modules/is-glob/index.js | 14 + node_modules/is-glob/package.json | 92 + node_modules/is-hexadecimal/index.js | 15 + node_modules/is-hexadecimal/license | 22 + node_modules/is-hexadecimal/package.json | 112 + node_modules/is-hexadecimal/readme.md | 70 + node_modules/is-hidden/index.js | 11 + node_modules/is-hidden/license | 22 + node_modules/is-hidden/package.json | 115 + node_modules/is-hidden/readme.md | 59 + node_modules/is-number/LICENSE | 21 + node_modules/is-number/README.md | 103 + node_modules/is-number/index.js | 19 + node_modules/is-number/package.json | 90 + node_modules/is-object/.jscs.json | 55 + node_modules/is-object/.npmignore | 15 + node_modules/is-object/.testem.json | 14 + node_modules/is-object/.travis.yml | 18 + node_modules/is-object/LICENSE | 19 + node_modules/is-object/README.md | 55 + node_modules/is-object/index.js | 5 + node_modules/is-object/package.json | 90 + node_modules/is-object/test/index.js | 23 + node_modules/is-plain-obj/index.js | 7 + node_modules/is-plain-obj/license | 21 + node_modules/is-plain-obj/package.json | 68 + node_modules/is-plain-obj/readme.md | 35 + 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/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 | 119 + node_modules/is-plain-object/package.json | 123 + node_modules/is-posix-bracket/LICENSE | 21 + node_modules/is-posix-bracket/README.md | 88 + node_modules/is-posix-bracket/index.js | 10 + node_modules/is-posix-bracket/package.json | 95 + node_modules/is-primitive/LICENSE | 21 + node_modules/is-primitive/README.md | 57 + node_modules/is-primitive/index.js | 13 + node_modules/is-primitive/package.json | 71 + node_modules/is-whitespace-character/index.js | 14 + node_modules/is-whitespace-character/license | 22 + .../is-whitespace-character/package.json | 114 + .../is-whitespace-character/readme.md | 74 + 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/is-word-character/index.js | 14 + node_modules/is-word-character/license | 22 + node_modules/is-word-character/package.json | 111 + node_modules/is-word-character/readme.md | 72 + 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 | 75 + node_modules/isarray/test.js | 20 + node_modules/isobject/LICENSE | 21 + node_modules/isobject/README.md | 112 + node_modules/isobject/index.js | 14 + node_modules/isobject/package.json | 98 + node_modules/js-yaml/CHANGELOG.md | 551 ++ node_modules/js-yaml/LICENSE | 21 + node_modules/js-yaml/README.md | 299 + node_modules/js-yaml/bin/js-yaml.js | 132 + node_modules/js-yaml/dist/js-yaml.js | 3989 ++++++++++ node_modules/js-yaml/dist/js-yaml.min.js | 1 + node_modules/js-yaml/index.js | 7 + node_modules/js-yaml/lib/js-yaml.js | 39 + node_modules/js-yaml/lib/js-yaml/common.js | 59 + node_modules/js-yaml/lib/js-yaml/dumper.js | 850 +++ node_modules/js-yaml/lib/js-yaml/exception.js | 43 + node_modules/js-yaml/lib/js-yaml/loader.js | 1644 ++++ node_modules/js-yaml/lib/js-yaml/mark.js | 76 + node_modules/js-yaml/lib/js-yaml/schema.js | 108 + .../js-yaml/lib/js-yaml/schema/core.js | 18 + .../lib/js-yaml/schema/default_full.js | 25 + .../lib/js-yaml/schema/default_safe.js | 28 + .../js-yaml/lib/js-yaml/schema/failsafe.js | 17 + .../js-yaml/lib/js-yaml/schema/json.js | 25 + node_modules/js-yaml/lib/js-yaml/type.js | 61 + .../js-yaml/lib/js-yaml/type/binary.js | 138 + node_modules/js-yaml/lib/js-yaml/type/bool.js | 35 + .../js-yaml/lib/js-yaml/type/float.js | 116 + node_modules/js-yaml/lib/js-yaml/type/int.js | 173 + .../js-yaml/lib/js-yaml/type/js/function.js | 93 + .../js-yaml/lib/js-yaml/type/js/regexp.js | 60 + .../js-yaml/lib/js-yaml/type/js/undefined.js | 28 + node_modules/js-yaml/lib/js-yaml/type/map.js | 8 + .../js-yaml/lib/js-yaml/type/merge.js | 12 + node_modules/js-yaml/lib/js-yaml/type/null.js | 34 + node_modules/js-yaml/lib/js-yaml/type/omap.js | 44 + .../js-yaml/lib/js-yaml/type/pairs.js | 53 + node_modules/js-yaml/lib/js-yaml/type/seq.js | 8 + node_modules/js-yaml/lib/js-yaml/type/set.js | 29 + node_modules/js-yaml/lib/js-yaml/type/str.js | 8 + .../js-yaml/lib/js-yaml/type/timestamp.js | 88 + node_modules/js-yaml/package.json | 95 + .../json-parse-better-errors/CHANGELOG.md | 46 + .../json-parse-better-errors/LICENSE.md | 7 + .../json-parse-better-errors/README.md | 46 + .../json-parse-better-errors/index.js | 38 + .../json-parse-better-errors/package.json | 76 + node_modules/json5/CHANGELOG.md | 169 + node_modules/json5/LICENSE.md | 21 + node_modules/json5/README.md | 286 + node_modules/json5/lib/cli.js | 41 + node_modules/json5/lib/json5.js | 770 ++ node_modules/json5/lib/require.js | 18 + node_modules/json5/package.json | 80 + 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 | 146 + node_modules/load-plugin/browser.js | 12 + node_modules/load-plugin/index.js | 112 + node_modules/load-plugin/license | 22 + node_modules/load-plugin/package.json | 105 + node_modules/load-plugin/readme.md | 126 + node_modules/longest-streak/index.js | 36 + node_modules/longest-streak/license | 22 + node_modules/longest-streak/package.json | 112 + node_modules/longest-streak/readme.md | 72 + 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-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/markdown-escapes/index.js | 57 + node_modules/markdown-escapes/license | 22 + node_modules/markdown-escapes/package.json | 112 + node_modules/markdown-escapes/readme.md | 80 + node_modules/markdown-extensions/index.js | 2 + node_modules/markdown-extensions/license | 21 + .../markdown-extensions.json | 10 + node_modules/markdown-extensions/package.json | 68 + node_modules/markdown-extensions/readme.md | 27 + node_modules/markdown-table/index.js | 250 + node_modules/markdown-table/license | 22 + node_modules/markdown-table/package.json | 115 + node_modules/markdown-table/readme.md | 180 + node_modules/math-random/.travis.yml | 6 + node_modules/math-random/browser.js | 17 + node_modules/math-random/node.js | 13 + node_modules/math-random/package.json | 51 + node_modules/math-random/readme.md | 26 + node_modules/math-random/test.js | 21 + node_modules/mdast-comment-marker/index.js | 78 + node_modules/mdast-comment-marker/license | 22 + .../mdast-comment-marker/package.json | 119 + node_modules/mdast-comment-marker/readme.md | 162 + node_modules/mdast-util-compact/index.js | 61 + node_modules/mdast-util-compact/license | 22 + node_modules/mdast-util-compact/package.json | 113 + node_modules/mdast-util-compact/readme.md | 127 + .../mdast-util-heading-style/index.js | 44 + node_modules/mdast-util-heading-style/license | 22 + .../mdast-util-heading-style/package.json | 118 + .../mdast-util-heading-style/readme.md | 120 + node_modules/mdast-util-to-string/index.js | 30 + node_modules/mdast-util-to-string/license | 22 + .../mdast-util-to-string/package.json | 122 + node_modules/mdast-util-to-string/readme.md | 128 + node_modules/micromatch/LICENSE | 21 + node_modules/micromatch/README.md | 689 ++ node_modules/micromatch/index.js | 431 ++ node_modules/micromatch/lib/chars.js | 67 + node_modules/micromatch/lib/expand.js | 304 + node_modules/micromatch/lib/glob.js | 193 + node_modules/micromatch/lib/utils.js | 149 + node_modules/micromatch/package.json | 145 + node_modules/minimatch/LICENSE | 15 + node_modules/minimatch/README.md | 209 + node_modules/minimatch/minimatch.js | 923 +++ node_modules/minimatch/package.json | 63 + node_modules/minimist/.travis.yml | 8 + node_modules/minimist/LICENSE | 18 + node_modules/minimist/example/parse.js | 2 + node_modules/minimist/index.js | 245 + node_modules/minimist/package.json | 74 + node_modules/minimist/readme.markdown | 95 + node_modules/minimist/test/all_bool.js | 32 + node_modules/minimist/test/bool.js | 178 + 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/proto.js | 44 + 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 | 64 + .../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/ms/index.js | 152 + node_modules/ms/license.md | 21 + node_modules/ms/package.json | 69 + node_modules/ms/readme.md | 51 + node_modules/nan/CHANGELOG.md | 533 ++ node_modules/nan/LICENSE.md | 13 + node_modules/nan/README.md | 455 ++ 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 | 583 ++ node_modules/nan/doc/methods.md | 664 ++ node_modules/nan/doc/new.md | 147 + node_modules/nan/doc/node_misc.md | 123 + node_modules/nan/doc/object_wrappers.md | 263 + node_modules/nan/doc/persistent.md | 296 + 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 | 2891 +++++++ node_modules/nan/nan_callbacks.h | 88 + node_modules/nan/nan_callbacks_12_inl.h | 514 ++ 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 | 68 + node_modules/nan/nan_converters_pre_43_inl.h | 42 + .../nan/nan_define_own_property_helper.h | 29 + node_modules/nan/nan_implementation_12_inl.h | 430 ++ .../nan/nan_implementation_pre_12_inl.h | 263 + node_modules/nan/nan_json.h | 166 + node_modules/nan/nan_maybe_43_inl.h | 356 + node_modules/nan/nan_maybe_pre_43_inl.h | 268 + node_modules/nan/nan_new.h | 340 + node_modules/nan/nan_object_wrap.h | 156 + 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 | 96 + node_modules/nan/nan_weak.h | 437 ++ node_modules/nan/package.json | 98 + 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/compilers.js | 339 + node_modules/nanomatch/lib/parsers.js | 386 + node_modules/nanomatch/lib/utils.js | 379 + .../nanomatch/node_modules/arr-diff/LICENSE | 21 + .../nanomatch/node_modules/arr-diff/README.md | 130 + .../nanomatch/node_modules/arr-diff/index.js | 47 + .../node_modules/arr-diff/package.json | 108 + .../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 | 93 + .../node_modules/kind-of/CHANGELOG.md | 160 + .../nanomatch/node_modules/kind-of/LICENSE | 21 + .../nanomatch/node_modules/kind-of/README.md | 367 + .../nanomatch/node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 143 + node_modules/nanomatch/package.json | 171 + 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-prefix/LICENSE | 21 + node_modules/npm-prefix/README.md | 37 + node_modules/npm-prefix/index.js | 22 + node_modules/npm-prefix/package.json | 73 + node_modules/number-is-nan/index.js | 4 + node_modules/number-is-nan/license | 21 + node_modules/number-is-nan/package.json | 67 + node_modules/number-is-nan/readme.md | 28 + 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 + 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/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 | 119 + node_modules/object-visit/package.json | 97 + node_modules/object.omit/LICENSE | 21 + node_modules/object.omit/README.md | 118 + node_modules/object.omit/index.js | 40 + node_modules/object.omit/package.json | 98 + node_modules/object.pick/LICENSE | 21 + node_modules/object.pick/README.md | 76 + node_modules/object.pick/index.js | 35 + .../object.pick/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 | 119 + node_modules/object.pick/package.json | 92 + node_modules/once/LICENSE | 15 + node_modules/once/README.md | 79 + node_modules/once/once.js | 42 + node_modules/once/package.json | 67 + node_modules/os-homedir/index.js | 24 + node_modules/os-homedir/license | 21 + node_modules/os-homedir/package.json | 73 + node_modules/os-homedir/readme.md | 31 + .../parse-entities/decode-entity.browser.js | 30 + node_modules/parse-entities/decode-entity.js | 13 + node_modules/parse-entities/index.js | 450 ++ node_modules/parse-entities/license | 22 + node_modules/parse-entities/package.json | 131 + node_modules/parse-entities/readme.md | 217 + node_modules/parse-glob/LICENSE | 21 + node_modules/parse-glob/README.md | 115 + node_modules/parse-glob/index.js | 156 + node_modules/parse-glob/package.json | 93 + node_modules/parse-json/index.js | 33 + node_modules/parse-json/license | 9 + node_modules/parse-json/package.json | 75 + node_modules/parse-json/readme.md | 83 + 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-is-absolute/index.js | 20 + node_modules/path-is-absolute/license | 21 + node_modules/path-is-absolute/package.json | 76 + node_modules/path-is-absolute/readme.md | 59 + node_modules/plur/index.d.ts | 38 + node_modules/plur/index.js | 31 + node_modules/plur/license | 9 + node_modules/plur/package.json | 79 + node_modules/plur/readme.md | 67 + node_modules/pluralize/LICENSE | 21 + node_modules/pluralize/Readme.md | 100 + node_modules/pluralize/package.json | 72 + node_modules/pluralize/pluralize.js | 503 ++ 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/preserve/.gitattributes | 14 + node_modules/preserve/.jshintrc | 24 + node_modules/preserve/.npmignore | 53 + node_modules/preserve/.travis.yml | 3 + node_modules/preserve/.verb.md | 59 + node_modules/preserve/LICENSE | 24 + node_modules/preserve/README.md | 90 + node_modules/preserve/index.js | 54 + node_modules/preserve/package.json | 73 + node_modules/preserve/test.js | 48 + node_modules/process-nextick-args/index.js | 45 + node_modules/process-nextick-args/license.md | 19 + .../process-nextick-args/package.json | 50 + node_modules/process-nextick-args/readme.md | 18 + node_modules/randomatic/LICENSE | 21 + node_modules/randomatic/README.md | 193 + node_modules/randomatic/index.js | 95 + .../randomatic/node_modules/is-number/LICENSE | 21 + .../node_modules/is-number/README.md | 135 + .../node_modules/is-number/index.js | 21 + .../node_modules/is-number/package.json | 113 + .../node_modules/kind-of/CHANGELOG.md | 160 + .../randomatic/node_modules/kind-of/LICENSE | 21 + .../randomatic/node_modules/kind-of/README.md | 367 + .../randomatic/node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 143 + node_modules/randomatic/package.json | 135 + node_modules/rc/LICENSE.APACHE2 | 15 + node_modules/rc/LICENSE.BSD | 26 + node_modules/rc/LICENSE.MIT | 24 + node_modules/rc/README.md | 227 + 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 | 64 + 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 | 34 + 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 | 131 + .../lib/_stream_passthrough.js | 47 + .../readable-stream/lib/_stream_readable.js | 1019 +++ .../readable-stream/lib/_stream_transform.js | 214 + .../readable-stream/lib/_stream_writable.js | 687 ++ .../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 | 82 + 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/LICENSE | 20 + node_modules/readdirp/README.md | 204 + .../readdirp/node_modules/arr-diff/LICENSE | 21 + .../readdirp/node_modules/arr-diff/README.md | 130 + .../readdirp/node_modules/arr-diff/index.js | 47 + .../node_modules/arr-diff/package.json | 108 + .../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 | 95 + .../readdirp/node_modules/braces/LICENSE | 21 + .../readdirp/node_modules/braces/README.md | 640 ++ .../readdirp/node_modules/braces/index.js | 318 + .../node_modules/braces/lib/braces.js | 104 + .../node_modules/braces/lib/compilers.js | 282 + .../node_modules/braces/lib/parsers.js | 360 + .../readdirp/node_modules/braces/lib/utils.js | 343 + .../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 + .../readdirp/node_modules/braces/package.json | 156 + .../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 + .../expand-brackets/lib/compilers.js | 87 + .../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 + .../readdirp/node_modules/extglob/LICENSE | 21 + .../readdirp/node_modules/extglob/README.md | 362 + .../node_modules/extglob/changelog.md | 25 + .../readdirp/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 + .../readdirp/node_modules/fill-range/LICENSE | 21 + .../node_modules/fill-range/README.md | 250 + .../readdirp/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 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 144 + .../is-accessor-descriptor/index.js | 69 + .../is-accessor-descriptor/package.json | 110 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 161 + .../node_modules/is-data-descriptor/index.js | 49 + .../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/is-descriptor/package.json | 114 + .../readdirp/node_modules/is-number/LICENSE | 21 + .../readdirp/node_modules/is-number/README.md | 115 + .../readdirp/node_modules/is-number/index.js | 22 + .../is-number/node_modules/kind-of/LICENSE | 21 + .../is-number/node_modules/kind-of/README.md | 261 + .../is-number/node_modules/kind-of/index.js | 116 + .../node_modules/kind-of/package.json | 139 + .../node_modules/is-number/package.json | 123 + .../readdirp/node_modules/isobject/LICENSE | 21 + .../readdirp/node_modules/isobject/README.md | 122 + .../readdirp/node_modules/isobject/index.d.ts | 5 + .../readdirp/node_modules/isobject/index.js | 12 + .../node_modules/isobject/package.json | 119 + .../node_modules/kind-of/CHANGELOG.md | 160 + .../readdirp/node_modules/kind-of/LICENSE | 21 + .../readdirp/node_modules/kind-of/README.md | 367 + .../readdirp/node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 146 + .../node_modules/micromatch/CHANGELOG.md | 37 + .../readdirp/node_modules/micromatch/LICENSE | 21 + .../node_modules/micromatch/README.md | 1150 +++ .../readdirp/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/micromatch/package.json | 216 + node_modules/readdirp/package.json | 101 + node_modules/readdirp/readdirp.js | 294 + node_modules/readdirp/stream-api.js | 98 + node_modules/regex-cache/LICENSE | 21 + node_modules/regex-cache/README.md | 166 + node_modules/regex-cache/index.js | 68 + node_modules/regex-cache/package.json | 101 + 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/remark-cli/cli.js | 24 + node_modules/remark-cli/package.json | 71 + node_modules/remark-cli/readme.md | 112 + .../index.js | 107 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../package.json | 77 + .../readme.md | 187 + .../index.js | 159 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../node_modules/vfile-location/index.js | 76 + .../node_modules/vfile-location/license | 22 + .../node_modules/vfile-location/package.json | 129 + .../node_modules/vfile-location/readme.md | 114 + .../vfile-location/types/index.d.ts | 34 + .../package.json | 77 + .../readme.md | 248 + .../remark-lint-code-block-style/index.js | 149 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../remark-lint-code-block-style/package.json | 74 + .../remark-lint-code-block-style/readme.md | 256 + .../remark-lint-definition-case/index.js | 52 + .../remark-lint-definition-case/package.json | 72 + .../remark-lint-definition-case/readme.md | 148 + .../remark-lint-definition-spacing/index.js | 50 + .../package.json | 72 + .../remark-lint-definition-spacing/readme.md | 150 + .../remark-lint-emphasis-marker/index.js | 107 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../remark-lint-emphasis-marker/package.json | 74 + .../remark-lint-emphasis-marker/readme.md | 224 + .../remark-lint-fenced-code-flag/index.js | 117 + .../remark-lint-fenced-code-flag/package.json | 74 + .../remark-lint-fenced-code-flag/readme.md | 229 + .../remark-lint-fenced-code-marker/index.js | 142 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../package.json | 75 + .../remark-lint-fenced-code-marker/readme.md | 243 + .../remark-lint-file-extension/index.js | 38 + .../remark-lint-file-extension/package.json | 70 + .../remark-lint-file-extension/readme.md | 155 + .../remark-lint-final-definition/index.js | 66 + .../remark-lint-final-definition/package.json | 73 + .../remark-lint-final-definition/readme.md | 155 + .../remark-lint-final-newline/index.js | 66 + .../remark-lint-final-newline/package.json | 70 + .../remark-lint-final-newline/readme.md | 163 + .../remark-lint-hard-break-spaces/index.js | 54 + .../package.json | 75 + .../remark-lint-hard-break-spaces/readme.md | 155 + .../remark-lint-heading-increment/index.js | 54 + .../package.json | 72 + .../remark-lint-heading-increment/readme.md | 152 + .../remark-lint-heading-style/index.js | 96 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../remark-lint-heading-style/package.json | 76 + .../remark-lint-heading-style/readme.md | 218 + .../remark-lint-link-title-style/index.js | 195 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../node_modules/vfile-location/index.js | 76 + .../node_modules/vfile-location/license | 22 + .../node_modules/vfile-location/package.json | 129 + .../node_modules/vfile-location/readme.md | 114 + .../vfile-location/types/index.d.ts | 34 + .../remark-lint-link-title-style/package.json | 77 + .../remark-lint-link-title-style/readme.md | 268 + .../index.js | 85 + .../package.json | 74 + .../readme.md | 165 + .../index.js | 105 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../package.json | 77 + .../readme.md | 155 + .../remark-lint-list-item-indent/index.js | 176 + .../remark-lint-list-item-indent/package.json | 75 + .../remark-lint-list-item-indent/readme.md | 289 + .../remark-lint-list-item-spacing/index.js | 198 + .../package.json | 74 + .../remark-lint-list-item-spacing/readme.md | 254 + .../index.js | 50 + .../package.json | 72 + .../readme.md | 156 + .../remark-lint-maximum-line-length/index.js | 176 + .../package.json | 72 + .../remark-lint-maximum-line-length/readme.md | 247 + .../index.js | 76 + .../package.json | 75 + .../readme.md | 163 + .../index.js | 95 + .../package.json | 75 + .../readme.md | 162 + .../index.js | 129 + .../package.json | 73 + .../readme.md | 196 + .../index.js | 62 + .../unist-util-stringify-position/index.js | 50 + .../unist-util-stringify-position/license | 22 + .../package.json | 123 + .../unist-util-stringify-position/readme.md | 140 + .../types/index.d.ts | 9 + .../package.json | 75 + .../readme.md | 150 + .../index.js | 65 + .../unist-util-stringify-position/index.js | 50 + .../unist-util-stringify-position/license | 22 + .../package.json | 123 + .../unist-util-stringify-position/readme.md | 140 + .../types/index.d.ts | 9 + .../package.json | 76 + .../readme.md | 155 + .../index.js | 61 + .../package.json | 71 + .../readme.md | 158 + .../index.js | 40 + .../package.json | 71 + .../readme.md | 160 + .../index.js | 31 + .../package.json | 72 + .../readme.md | 136 + .../index.js | 59 + .../package.json | 71 + .../readme.md | 169 + .../index.js | 35 + .../package.json | 70 + .../readme.md | 142 + .../index.js | 35 + .../package.json | 71 + .../readme.md | 144 + .../index.js | 157 + .../package.json | 75 + .../readme.md | 208 + .../index.js | 77 + .../package.json | 72 + .../readme.md | 179 + .../remark-lint-no-inline-padding/index.js | 53 + .../package.json | 73 + .../remark-lint-no-inline-padding/readme.md | 154 + .../remark-lint-no-literal-urls/index.js | 65 + .../remark-lint-no-literal-urls/package.json | 74 + .../remark-lint-no-literal-urls/readme.md | 161 + .../index.js | 59 + .../unist-util-stringify-position/index.js | 50 + .../unist-util-stringify-position/license | 22 + .../package.json | 123 + .../unist-util-stringify-position/readme.md | 140 + .../types/index.d.ts | 9 + .../package.json | 75 + .../readme.md | 158 + .../remark-lint-no-shell-dollars/index.js | 103 + .../remark-lint-no-shell-dollars/package.json | 71 + .../remark-lint-no-shell-dollars/readme.md | 173 + .../index.js | 53 + .../package.json | 73 + .../readme.md | 159 + .../index.js | 53 + .../package.json | 73 + .../readme.md | 159 + .../remark-lint-no-table-indentation/index.js | 73 + .../package.json | 72 + .../readme.md | 167 + .../index.js | 78 + .../package.json | 72 + .../readme.md | 170 + .../index.js | 63 + .../package.json | 70 + .../readme.md | 150 + .../index.js | 117 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../package.json | 75 + .../readme.md | 210 + .../index.js | 195 + .../package.json | 73 + .../readme.md | 309 + node_modules/remark-lint-rule-style/index.js | 100 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../remark-lint-rule-style/package.json | 75 + node_modules/remark-lint-rule-style/readme.md | 203 + .../remark-lint-strong-marker/index.js | 96 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../remark-lint-strong-marker/package.json | 75 + .../remark-lint-strong-marker/readme.md | 215 + .../remark-lint-table-cell-padding/index.js | 295 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../package.json | 75 + .../remark-lint-table-cell-padding/readme.md | 363 + .../remark-lint-table-pipe-alignment/index.js | 112 + .../package.json | 74 + .../readme.md | 172 + node_modules/remark-lint-table-pipes/index.js | 91 + .../remark-lint-table-pipes/package.json | 73 + .../remark-lint-table-pipes/readme.md | 166 + .../index.js | 131 + .../package.json | 73 + .../readme.md | 231 + node_modules/remark-lint/index.js | 16 + node_modules/remark-lint/package.json | 66 + node_modules/remark-lint/readme.md | 51 + node_modules/remark-message-control/index.js | 16 + node_modules/remark-message-control/license | 22 + .../remark-message-control/package.json | 124 + node_modules/remark-message-control/readme.md | 214 + node_modules/remark-parse/index.js | 14 + .../remark-parse/lib/block-elements.json | 68 + node_modules/remark-parse/lib/decode.js | 64 + node_modules/remark-parse/lib/defaults.js | 10 + node_modules/remark-parse/lib/locate/break.js | 17 + .../remark-parse/lib/locate/code-inline.js | 7 + .../remark-parse/lib/locate/delete.js | 7 + .../remark-parse/lib/locate/emphasis.js | 18 + .../remark-parse/lib/locate/escape.js | 7 + node_modules/remark-parse/lib/locate/link.js | 16 + .../remark-parse/lib/locate/strong.js | 18 + node_modules/remark-parse/lib/locate/tag.js | 7 + node_modules/remark-parse/lib/locate/url.js | 26 + node_modules/remark-parse/lib/parse.js | 45 + node_modules/remark-parse/lib/parser.js | 152 + node_modules/remark-parse/lib/set-options.js | 47 + .../remark-parse/lib/tokenize/auto-link.js | 145 + .../remark-parse/lib/tokenize/blockquote.js | 129 + .../remark-parse/lib/tokenize/break.js | 40 + .../remark-parse/lib/tokenize/code-fenced.js | 236 + .../lib/tokenize/code-indented.js | 98 + .../remark-parse/lib/tokenize/code-inline.js | 112 + .../remark-parse/lib/tokenize/definition.js | 278 + .../remark-parse/lib/tokenize/delete.js | 60 + .../remark-parse/lib/tokenize/emphasis.js | 85 + .../remark-parse/lib/tokenize/escape.js | 34 + .../lib/tokenize/footnote-definition.js | 185 + .../remark-parse/lib/tokenize/heading-atx.js | 141 + .../lib/tokenize/heading-setext.js | 107 + .../remark-parse/lib/tokenize/html-block.js | 94 + .../remark-parse/lib/tokenize/html-inline.js | 54 + .../remark-parse/lib/tokenize/link.js | 392 + .../remark-parse/lib/tokenize/list.js | 474 ++ .../remark-parse/lib/tokenize/newline.js | 47 + .../remark-parse/lib/tokenize/paragraph.js | 122 + .../remark-parse/lib/tokenize/reference.js | 206 + .../remark-parse/lib/tokenize/strong.js | 84 + .../remark-parse/lib/tokenize/table.js | 266 + .../remark-parse/lib/tokenize/text.js | 58 + .../lib/tokenize/thematic-break.js | 70 + node_modules/remark-parse/lib/tokenize/url.js | 144 + node_modules/remark-parse/lib/tokenizer.js | 331 + node_modules/remark-parse/lib/unescape.js | 37 + .../remark-parse/lib/util/get-indentation.js | 32 + node_modules/remark-parse/lib/util/html.js | 25 + .../remark-parse/lib/util/interrupt.js | 43 + .../remark-parse/lib/util/normalize.js | 11 + .../lib/util/remove-indentation.js | 78 + node_modules/remark-parse/package.json | 85 + node_modules/remark-parse/readme.md | 453 ++ .../remark-preset-lint-consistent/index.js | 23 + .../index.js | 161 + .../package.json | 74 + .../readme.md | 260 + .../remark-lint-table-cell-padding/index.js | 304 + .../package.json | 73 + .../remark-lint-table-cell-padding/readme.md | 388 + .../node_modules/remark-lint/index.js | 16 + .../node_modules/remark-lint/package.json | 71 + .../node_modules/remark-lint/readme.md | 126 + .../remark-message-control/index.js | 15 + .../remark-message-control/license | 22 + .../remark-message-control/package.json | 129 + .../remark-message-control/readme.md | 228 + .../unified-message-control/index.d.ts | 116 + .../unified-message-control/index.js | 293 + .../unified-message-control/license | 22 + .../unified-message-control/package.json | 141 + .../unified-message-control/readme.md | 229 + .../node_modules/unist-util-is/convert.d.ts | 6 + .../node_modules/unist-util-is/convert.js | 87 + .../node_modules/unist-util-is/index.d.ts | 66 + .../node_modules/unist-util-is/index.js | 37 + .../node_modules/unist-util-is/license | 22 + .../node_modules/unist-util-is/package.json | 134 + .../node_modules/unist-util-is/readme.md | 205 + .../unist-util-visit-parents/color.browser.js | 4 + .../unist-util-visit-parents/color.js | 4 + .../unist-util-visit-parents/index.js | 110 + .../unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 142 + .../unist-util-visit-parents/readme.md | 233 + .../unist-util-visit-parents/types/index.d.ts | 111 + .../node_modules/unist-util-visit/index.js | 29 + .../node_modules/unist-util-visit/license | 22 + .../unist-util-visit/package.json | 150 + .../node_modules/unist-util-visit/readme.md | 136 + .../unist-util-visit/types/index.d.ts | 88 + .../node_modules/vfile-location/index.js | 76 + .../node_modules/vfile-location/license | 22 + .../node_modules/vfile-location/package.json | 129 + .../node_modules/vfile-location/readme.md | 114 + .../vfile-location/types/index.d.ts | 34 + .../package.json | 87 + .../remark-preset-lint-consistent/readme.md | 126 + .../index.js | 235 + .../index.js | 105 + .../package.json | 75 + .../readme.md | 187 + .../remark-lint-code-block-style/index.js | 149 + .../remark-lint-code-block-style/package.json | 72 + .../remark-lint-code-block-style/readme.md | 256 + .../remark-lint-emphasis-marker/index.js | 107 + .../remark-lint-emphasis-marker/package.json | 72 + .../remark-lint-emphasis-marker/readme.md | 224 + .../remark-lint-fenced-code-marker/index.js | 142 + .../package.json | 73 + .../remark-lint-fenced-code-marker/readme.md | 243 + .../remark-lint-heading-style/index.js | 96 + .../remark-lint-heading-style/package.json | 74 + .../remark-lint-heading-style/readme.md | 218 + .../remark-lint-link-title-style/index.js | 195 + .../remark-lint-link-title-style/package.json | 75 + .../remark-lint-link-title-style/readme.md | 268 + .../index.js | 103 + .../package.json | 75 + .../readme.md | 155 + .../index.js | 117 + .../package.json | 73 + .../readme.md | 210 + .../remark-lint-rule-style/index.js | 100 + .../remark-lint-rule-style/package.json | 73 + .../remark-lint-rule-style/readme.md | 203 + .../remark-lint-strong-marker/index.js | 96 + .../remark-lint-strong-marker/package.json | 73 + .../remark-lint-strong-marker/readme.md | 215 + .../remark-lint-table-cell-padding/index.js | 295 + .../package.json | 73 + .../remark-lint-table-cell-padding/readme.md | 363 + .../package.json | 118 + .../readme.md | 186 + .../remark-preset-lint-recommended/index.js | 32 + .../index.js | 117 + .../package.json | 73 + .../readme.md | 210 + .../package.json | 83 + .../remark-preset-lint-recommended/readme.md | 72 + node_modules/remark-stringify/index.js | 14 + node_modules/remark-stringify/lib/compiler.js | 63 + node_modules/remark-stringify/lib/defaults.js | 28 + node_modules/remark-stringify/lib/escape.js | 247 + .../remark-stringify/lib/macro/all.js | 18 + .../remark-stringify/lib/macro/block.js | 45 + .../remark-stringify/lib/macro/compile.js | 10 + .../remark-stringify/lib/macro/one.js | 21 + .../lib/macro/ordered-items.js | 37 + .../lib/macro/unordered-items.js | 22 + .../remark-stringify/lib/set-options.js | 168 + .../lib/util/copy-identifier-encoding.js | 60 + .../lib/util/enclose-title.js | 13 + .../remark-stringify/lib/util/enclose-uri.js | 24 + .../lib/util/enter-link-reference.js | 36 + .../lib/util/entity-prefix-length.js | 23 + .../remark-stringify/lib/util/label.js | 16 + node_modules/remark-stringify/lib/util/pad.js | 27 + .../remark-stringify/lib/util/returner.js | 7 + .../lib/visitors/blockquote.js | 18 + .../remark-stringify/lib/visitors/break.js | 9 + .../remark-stringify/lib/visitors/code.js | 63 + .../lib/visitors/definition.js | 23 + .../remark-stringify/lib/visitors/delete.js | 7 + .../remark-stringify/lib/visitors/emphasis.js | 16 + .../lib/visitors/footnote-definition.js | 12 + .../lib/visitors/footnote-reference.js | 7 + .../remark-stringify/lib/visitors/footnote.js | 7 + .../remark-stringify/lib/visitors/heading.js | 39 + .../remark-stringify/lib/visitors/html.js | 7 + .../lib/visitors/image-reference.js | 9 + .../remark-stringify/lib/visitors/image.js | 31 + .../lib/visitors/inline-code.js | 35 + .../lib/visitors/link-reference.js | 21 + .../remark-stringify/lib/visitors/link.js | 53 + .../lib/visitors/list-item.js | 61 + .../remark-stringify/lib/visitors/list.js | 13 + .../lib/visitors/paragraph.js | 7 + .../remark-stringify/lib/visitors/root.js | 9 + .../remark-stringify/lib/visitors/strong.js | 18 + .../lib/visitors/table-cell.js | 7 + .../remark-stringify/lib/visitors/table.js | 66 + .../remark-stringify/lib/visitors/text.js | 17 + .../lib/visitors/thematic-break.js | 26 + node_modules/remark-stringify/package.json | 84 + node_modules/remark-stringify/readme.md | 263 + node_modules/remark/index.js | 7 + node_modules/remark/package.json | 71 + node_modules/remark/readme.md | 141 + .../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 | 99 + node_modules/repeat-element/index.js | 18 + node_modules/repeat-element/package.json | 82 + 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 | 133 + node_modules/replace-ext/LICENSE | 21 + node_modules/replace-ext/README.md | 50 + node_modules/replace-ext/index.js | 18 + node_modules/replace-ext/package.json | 86 + node_modules/resolve-from/index.d.ts | 31 + node_modules/resolve-from/index.js | 47 + node_modules/resolve-from/license | 9 + node_modules/resolve-from/package.json | 68 + node_modules/resolve-from/readme.md | 72 + 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/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/safe-buffer/LICENSE | 21 + node_modules/safe-buffer/README.md | 584 ++ node_modules/safe-buffer/index.d.ts | 187 + node_modules/safe-buffer/index.js | 62 + node_modules/safe-buffer/package.json | 63 + 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/set-value/LICENSE | 21 + node_modules/set-value/README.md | 150 + node_modules/set-value/index.js | 55 + .../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 | 121 + node_modules/shellsubstitute/.npmignore | 2 + node_modules/shellsubstitute/.travis.yml | 3 + node_modules/shellsubstitute/index.js | 9 + node_modules/shellsubstitute/package.json | 63 + node_modules/shellsubstitute/readme.md | 22 + node_modules/shellsubstitute/test/spec.js | 63 + 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 + .../is-accessor-descriptor/LICENSE | 21 + .../is-accessor-descriptor/README.md | 144 + .../is-accessor-descriptor/index.js | 69 + .../is-accessor-descriptor/package.json | 110 + .../node_modules/is-data-descriptor/LICENSE | 21 + .../node_modules/is-data-descriptor/README.md | 161 + .../node_modules/is-data-descriptor/index.js | 49 + .../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/is-descriptor/package.json | 114 + .../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 | 119 + .../node_modules/kind-of/CHANGELOG.md | 160 + .../node_modules/kind-of/LICENSE | 21 + .../node_modules/kind-of/README.md | 367 + .../node_modules/kind-of/index.js | 129 + .../node_modules/kind-of/package.json | 145 + node_modules/snapdragon-node/package.json | 107 + 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 + node_modules/snapdragon/package.json | 126 + node_modules/source-map-resolve/LICENSE | 22 + node_modules/source-map-resolve/changelog.md | 108 + .../lib/decode-uri-component.js | 8 + .../source-map-resolve/lib/resolve-url.js | 9 + .../lib/source-map-resolve-node.js | 342 + node_modules/source-map-resolve/package.json | 81 + node_modules/source-map-resolve/readme.md | 231 + .../source-map-resolve/source-map-resolve.js | 348 + 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/CHANGELOG.md | 301 + node_modules/source-map/LICENSE | 28 + node_modules/source-map/README.md | 729 ++ .../source-map/dist/source-map.debug.js | 3091 ++++++++ node_modules/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 + node_modules/source-map/lib/binary-search.js | 111 + node_modules/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 + node_modules/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/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/sprintf-js/.npmignore | 1 + node_modules/sprintf-js/LICENSE | 24 + node_modules/sprintf-js/README.md | 88 + node_modules/sprintf-js/bower.json | 14 + node_modules/sprintf-js/demo/angular.html | 20 + .../sprintf-js/dist/angular-sprintf.min.js | 4 + .../dist/angular-sprintf.min.js.map | 1 + .../sprintf-js/dist/angular-sprintf.min.map | 1 + node_modules/sprintf-js/dist/sprintf.min.js | 4 + .../sprintf-js/dist/sprintf.min.js.map | 1 + node_modules/sprintf-js/dist/sprintf.min.map | 1 + node_modules/sprintf-js/gruntfile.js | 36 + node_modules/sprintf-js/package.json | 54 + .../sprintf-js/src/angular-sprintf.js | 18 + node_modules/sprintf-js/src/sprintf.js | 208 + node_modules/sprintf-js/test/test.js | 82 + node_modules/state-toggle/index.js | 23 + node_modules/state-toggle/license | 22 + node_modules/state-toggle/package.json | 110 + node_modules/state-toggle/readme.md | 95 + 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 + node_modules/static-extend/package.json | 96 + node_modules/string-width/index.js | 37 + node_modules/string-width/license | 21 + node_modules/string-width/package.json | 88 + node_modules/string-width/readme.md | 42 + node_modules/string_decoder/.travis.yml | 50 + node_modules/string_decoder/LICENSE | 48 + node_modules/string_decoder/README.md | 47 + .../string_decoder/lib/string_decoder.js | 296 + node_modules/string_decoder/package.json | 59 + node_modules/stringify-entities/LICENSE | 22 + .../stringify-entities/dangerous.json | 10 + node_modules/stringify-entities/index.js | 134 + node_modules/stringify-entities/package.json | 123 + node_modules/stringify-entities/readme.md | 131 + node_modules/strip-ansi/index.js | 6 + node_modules/strip-ansi/license | 21 + node_modules/strip-ansi/package.json | 101 + node_modules/strip-ansi/readme.md | 33 + 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 | 131 + node_modules/supports-color/license | 9 + node_modules/supports-color/package.json | 85 + node_modules/supports-color/readme.md | 66 + node_modules/text-table/.travis.yml | 4 + node_modules/text-table/LICENSE | 18 + node_modules/text-table/example/align.js | 8 + node_modules/text-table/example/center.js | 8 + node_modules/text-table/example/dotalign.js | 9 + node_modules/text-table/example/doubledot.js | 11 + node_modules/text-table/example/table.js | 6 + node_modules/text-table/index.js | 86 + node_modules/text-table/package.json | 73 + node_modules/text-table/readme.markdown | 134 + node_modules/text-table/test/align.js | 18 + node_modules/text-table/test/ansi-colors.js | 32 + node_modules/text-table/test/center.js | 18 + node_modules/text-table/test/dotalign.js | 20 + node_modules/text-table/test/doubledot.js | 24 + node_modules/text-table/test/table.js | 14 + 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 | 79 + 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/is-number/LICENSE | 21 + .../node_modules/is-number/README.md | 115 + .../node_modules/is-number/index.js | 22 + .../node_modules/is-number/package.json | 121 + node_modules/to-regex-range/package.json | 119 + 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/to-vfile/LICENSE | 22 + node_modules/to-vfile/index.js | 2 + node_modules/to-vfile/lib/core.js | 18 + node_modules/to-vfile/lib/fs.js | 90 + node_modules/to-vfile/package.json | 111 + node_modules/to-vfile/readme.md | 116 + node_modules/trim-trailing-lines/index.js | 17 + node_modules/trim-trailing-lines/license | 22 + node_modules/trim-trailing-lines/package.json | 111 + node_modules/trim-trailing-lines/readme.md | 68 + node_modules/trim/.npmignore | 4 + node_modules/trim/History.md | 5 + node_modules/trim/Makefile | 7 + node_modules/trim/Readme.md | 69 + node_modules/trim/component.json | 7 + node_modules/trim/index.js | 14 + node_modules/trim/package.json | 50 + node_modules/trough/index.js | 74 + node_modules/trough/license | 21 + node_modules/trough/package.json | 115 + node_modules/trough/readme.md | 330 + node_modules/trough/wrap.js | 64 + node_modules/typedarray/.travis.yml | 4 + node_modules/typedarray/LICENSE | 35 + node_modules/typedarray/example/tarray.js | 4 + node_modules/typedarray/index.js | 630 ++ node_modules/typedarray/package.json | 83 + node_modules/typedarray/readme.markdown | 61 + .../typedarray/test/server/undef_globals.js | 19 + node_modules/typedarray/test/tarray.js | 10 + node_modules/unherit/index.js | 45 + node_modules/unherit/license | 21 + node_modules/unherit/package.json | 112 + node_modules/unherit/readme.md | 79 + node_modules/unified-args/LICENSE | 21 + node_modules/unified-args/index.js | 2 + node_modules/unified-args/lib/index.js | 156 + node_modules/unified-args/lib/options.js | 277 + node_modules/unified-args/lib/schema.json | 143 + node_modules/unified-args/package.json | 111 + node_modules/unified-args/readme.md | 695 ++ node_modules/unified-engine/LICENSE | 21 + .../unified-engine/lib/configuration.js | 276 + .../lib/file-pipeline/configure.js | 70 + .../unified-engine/lib/file-pipeline/copy.js | 67 + .../lib/file-pipeline/file-system.js | 40 + .../unified-engine/lib/file-pipeline/index.js | 50 + .../unified-engine/lib/file-pipeline/parse.js | 44 + .../unified-engine/lib/file-pipeline/queue.js | 60 + .../unified-engine/lib/file-pipeline/read.js | 36 + .../lib/file-pipeline/stdout.js | 22 + .../lib/file-pipeline/stringify.js | 50 + .../lib/file-pipeline/transform.js | 23 + .../lib/file-set-pipeline/configure.js | 9 + .../lib/file-set-pipeline/file-system.js | 55 + .../lib/file-set-pipeline/index.js | 15 + .../lib/file-set-pipeline/log.js | 44 + .../lib/file-set-pipeline/stdin.js | 56 + .../lib/file-set-pipeline/transform.js | 52 + node_modules/unified-engine/lib/file-set.js | 116 + node_modules/unified-engine/lib/find-up.js | 179 + node_modules/unified-engine/lib/finder.js | 251 + node_modules/unified-engine/lib/ignore.js | 50 + node_modules/unified-engine/lib/index.js | 141 + .../node_modules/debug/CHANGELOG.md | 395 + .../unified-engine/node_modules/debug/LICENSE | 19 + .../node_modules/debug/README.md | 437 ++ .../node_modules/debug/dist/debug.js | 886 +++ .../unified-engine/node_modules/debug/node.js | 1 + .../node_modules/debug/package.json | 90 + .../node_modules/debug/src/browser.js | 180 + .../node_modules/debug/src/common.js | 249 + .../node_modules/debug/src/index.js | 12 + .../node_modules/debug/src/node.js | 174 + .../unified-engine/node_modules/ms/index.js | 162 + .../unified-engine/node_modules/ms/license.md | 21 + .../node_modules/ms/package.json | 69 + .../unified-engine/node_modules/ms/readme.md | 60 + node_modules/unified-engine/package.json | 121 + node_modules/unified-engine/readme.md | 287 + node_modules/unified-lint-rule/index.js | 116 + node_modules/unified-lint-rule/package.json | 130 + node_modules/unified-lint-rule/readme.md | 96 + node_modules/unified-message-control/LICENSE | 22 + node_modules/unified-message-control/index.js | 304 + .../unified-message-control/package.json | 119 + .../unified-message-control/readme.md | 205 + node_modules/unified/LICENSE | 21 + node_modules/unified/index.js | 466 ++ node_modules/unified/package.json | 125 + node_modules/unified/readme.md | 993 +++ node_modules/union-value/LICENSE | 21 + node_modules/union-value/README.md | 73 + node_modules/union-value/index.js | 30 + node_modules/union-value/package.json | 101 + node_modules/unist-util-generated/index.js | 15 + node_modules/unist-util-generated/license | 22 + .../unist-util-generated/package.json | 166 + node_modules/unist-util-generated/readme.md | 116 + node_modules/unist-util-inspect/index.js | 205 + node_modules/unist-util-inspect/license | 22 + node_modules/unist-util-inspect/package.json | 114 + node_modules/unist-util-inspect/readme.md | 128 + node_modules/unist-util-is/convert.js | 87 + node_modules/unist-util-is/index.js | 37 + node_modules/unist-util-is/license | 22 + node_modules/unist-util-is/package.json | 114 + node_modules/unist-util-is/readme.md | 202 + node_modules/unist-util-position/index.js | 29 + node_modules/unist-util-position/license | 22 + node_modules/unist-util-position/package.json | 156 + node_modules/unist-util-position/readme.md | 123 + .../unist-util-remove-position/index.js | 18 + .../unist-util-remove-position/license | 22 + .../unist-util-remove-position/package.json | 115 + .../unist-util-remove-position/readme.md | 131 + .../unist-util-stringify-position/LICENSE | 22 + .../unist-util-stringify-position/index.js | 50 + .../package.json | 118 + .../unist-util-stringify-position/readme.md | 100 + .../unist-util-visit-parents/index.js | 78 + node_modules/unist-util-visit-parents/license | 22 + .../unist-util-visit-parents/package.json | 109 + .../unist-util-visit-parents/readme.md | 218 + node_modules/unist-util-visit/index.js | 29 + node_modules/unist-util-visit/license | 22 + node_modules/unist-util-visit/package.json | 170 + node_modules/unist-util-visit/readme.md | 121 + 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 + .../unset-value/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 | 119 + node_modules/unset-value/package.json | 112 + node_modules/untildify/index.js | 11 + node_modules/untildify/license | 21 + node_modules/untildify/package.json | 79 + node_modules/untildify/readme.md | 30 + 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/use/LICENSE | 21 + node_modules/use/README.md | 90 + node_modules/use/index.js | 155 + node_modules/use/package.json | 108 + 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/vfile-location/index.js | 74 + node_modules/vfile-location/license | 22 + node_modules/vfile-location/package.json | 115 + node_modules/vfile-location/readme.md | 115 + node_modules/vfile-message/index.js | 94 + node_modules/vfile-message/license | 22 + node_modules/vfile-message/package.json | 112 + node_modules/vfile-message/readme.md | 194 + node_modules/vfile-reporter/LICENSE | 23 + node_modules/vfile-reporter/index.js | 320 + .../node_modules/has-flag/index.js | 10 + .../node_modules/has-flag/license | 21 + .../node_modules/has-flag/package.json | 93 + .../node_modules/has-flag/readme.md | 67 + .../node_modules/supports-color/browser.js | 2 + .../node_modules/supports-color/index.js | 115 + .../node_modules/supports-color/license | 9 + .../node_modules/supports-color/package.json | 85 + .../node_modules/supports-color/readme.md | 66 + node_modules/vfile-reporter/package.json | 113 + node_modules/vfile-reporter/readme.md | 123 + node_modules/vfile-statistics/index.js | 50 + node_modules/vfile-statistics/license | 22 + node_modules/vfile-statistics/package.json | 121 + node_modules/vfile-statistics/readme.md | 120 + node_modules/vfile/LICENSE | 21 + node_modules/vfile/core.js | 169 + node_modules/vfile/index.js | 53 + node_modules/vfile/package.json | 133 + node_modules/vfile/readme.md | 285 + node_modules/wrapped/History.md | 43 + node_modules/wrapped/Readme.md | 80 + node_modules/wrapped/index.js | 112 + node_modules/wrapped/package.json | 61 + node_modules/wrappy/LICENSE | 15 + node_modules/wrappy/README.md | 36 + node_modules/wrappy/package.json | 59 + node_modules/wrappy/wrappy.js | 33 + node_modules/x-is-function/LICENSE | 21 + node_modules/x-is-function/README.md | 41 + node_modules/x-is-function/index.js | 3 + node_modules/x-is-function/package.json | 47 + node_modules/x-is-string/.npmignore | 16 + node_modules/x-is-string/.travis.yml | 8 + node_modules/x-is-string/LICENCE | 19 + node_modules/x-is-string/README.md | 46 + node_modules/x-is-string/index.js | 7 + node_modules/x-is-string/package.json | 87 + node_modules/x-is-string/test/index.js | 51 + node_modules/xtend/.jshintrc | 30 + node_modules/xtend/LICENSE | 20 + node_modules/xtend/README.md | 32 + node_modules/xtend/immutable.js | 19 + node_modules/xtend/mutable.js | 17 + node_modules/xtend/package.json | 90 + node_modules/xtend/test.js | 103 + package-lock.json | 3542 +++++++++ 2210 files changed, 239437 insertions(+) create mode 120000 node_modules/.bin/atob create mode 120000 node_modules/.bin/esparse create mode 120000 node_modules/.bin/esvalidate create mode 120000 node_modules/.bin/js-yaml create mode 120000 node_modules/.bin/json5 create mode 120000 node_modules/.bin/rc create mode 120000 node_modules/.bin/remark create mode 100644 node_modules/@types/unist/LICENSE create mode 100644 node_modules/@types/unist/README.md create mode 100644 node_modules/@types/unist/index.d.ts create mode 100644 node_modules/@types/unist/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 100644 node_modules/argparse/CHANGELOG.md create mode 100644 node_modules/argparse/LICENSE create mode 100644 node_modules/argparse/README.md create mode 100644 node_modules/argparse/index.js create mode 100644 node_modules/argparse/lib/action.js create mode 100644 node_modules/argparse/lib/action/append.js create mode 100644 node_modules/argparse/lib/action/append/constant.js create mode 100644 node_modules/argparse/lib/action/count.js create mode 100644 node_modules/argparse/lib/action/help.js create mode 100644 node_modules/argparse/lib/action/store.js create mode 100644 node_modules/argparse/lib/action/store/constant.js create mode 100644 node_modules/argparse/lib/action/store/false.js create mode 100644 node_modules/argparse/lib/action/store/true.js create mode 100644 node_modules/argparse/lib/action/subparsers.js create mode 100644 node_modules/argparse/lib/action/version.js create mode 100644 node_modules/argparse/lib/action_container.js create mode 100644 node_modules/argparse/lib/argparse.js create mode 100644 node_modules/argparse/lib/argument/error.js create mode 100644 node_modules/argparse/lib/argument/exclusive.js create mode 100644 node_modules/argparse/lib/argument/group.js create mode 100644 node_modules/argparse/lib/argument_parser.js create mode 100644 node_modules/argparse/lib/const.js create mode 100644 node_modules/argparse/lib/help/added_formatters.js create mode 100644 node_modules/argparse/lib/help/formatter.js create mode 100644 node_modules/argparse/lib/namespace.js create mode 100644 node_modules/argparse/lib/utils.js create mode 100644 node_modules/argparse/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 100755 node_modules/array-unique/LICENSE create mode 100755 node_modules/array-unique/README.md create mode 100755 node_modules/array-unique/index.js create mode 100755 node_modules/array-unique/package.json 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/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/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/bail/index.js create mode 100644 node_modules/bail/license create mode 100644 node_modules/bail/package.json create mode 100644 node_modules/bail/readme.md 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/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/base/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/base/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/base/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/base/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/base/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/base/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/base/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/base/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/base/node_modules/is-descriptor/README.md create mode 100644 node_modules/base/node_modules/is-descriptor/index.js create mode 100644 node_modules/base/node_modules/is-descriptor/package.json create mode 100644 node_modules/base/node_modules/isobject/LICENSE create mode 100644 node_modules/base/node_modules/isobject/README.md create mode 100644 node_modules/base/node_modules/isobject/index.d.ts create mode 100644 node_modules/base/node_modules/isobject/index.js create mode 100644 node_modules/base/node_modules/isobject/package.json create mode 100644 node_modules/base/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/base/node_modules/kind-of/LICENSE create mode 100644 node_modules/base/node_modules/kind-of/README.md create mode 100644 node_modules/base/node_modules/kind-of/index.js create mode 100644 node_modules/base/node_modules/kind-of/package.json create mode 100644 node_modules/base/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/bindings/LICENSE.md create mode 100644 node_modules/bindings/README.md create mode 100644 node_modules/bindings/bindings.js create mode 100644 node_modules/bindings/package.json 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/package.json create mode 100644 node_modules/buffer-from/LICENSE create mode 100644 node_modules/buffer-from/index.js create mode 100644 node_modules/buffer-from/package.json create mode 100644 node_modules/buffer-from/readme.md 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/node_modules/isobject/LICENSE create mode 100644 node_modules/cache-base/node_modules/isobject/README.md create mode 100644 node_modules/cache-base/node_modules/isobject/index.d.ts create mode 100644 node_modules/cache-base/node_modules/isobject/index.js create mode 100644 node_modules/cache-base/node_modules/isobject/package.json 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/ccount/index.js create mode 100644 node_modules/ccount/license create mode 100644 node_modules/ccount/package.json create mode 100644 node_modules/ccount/readme.md create mode 100644 node_modules/chalk/index.js create mode 100644 node_modules/chalk/index.js.flow 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-entities-html4/index.json create mode 100644 node_modules/character-entities-html4/license create mode 100644 node_modules/character-entities-html4/package.json create mode 100644 node_modules/character-entities-html4/readme.md create mode 100644 node_modules/character-entities-legacy/index.json create mode 100644 node_modules/character-entities-legacy/license create mode 100644 node_modules/character-entities-legacy/package.json create mode 100644 node_modules/character-entities-legacy/readme.md create mode 100644 node_modules/character-entities/index.json create mode 100644 node_modules/character-entities/license create mode 100644 node_modules/character-entities/package.json create mode 100644 node_modules/character-entities/readme.md create mode 100644 node_modules/character-reference-invalid/index.json create mode 100644 node_modules/character-reference-invalid/license create mode 100644 node_modules/character-reference-invalid/package.json create mode 100644 node_modules/character-reference-invalid/readme.md 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/isobject/LICENSE create mode 100644 node_modules/class-utils/node_modules/isobject/README.md create mode 100644 node_modules/class-utils/node_modules/isobject/index.d.ts create mode 100644 node_modules/class-utils/node_modules/isobject/index.js create mode 100644 node_modules/class-utils/node_modules/isobject/package.json create mode 100644 node_modules/class-utils/package.json create mode 100644 node_modules/co/Readme.md create mode 100644 node_modules/co/index.js create mode 100644 node_modules/co/package.json create mode 100644 node_modules/code-point-at/index.js create mode 100644 node_modules/code-point-at/license create mode 100644 node_modules/code-point-at/package.json create mode 100644 node_modules/code-point-at/readme.md create mode 100644 node_modules/collapse-white-space/index.js create mode 100644 node_modules/collapse-white-space/license create mode 100644 node_modules/collapse-white-space/package.json create mode 100644 node_modules/collapse-white-space/readme.md 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/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/concat-stream/LICENSE create mode 100644 node_modules/concat-stream/index.js create mode 100644 node_modules/concat-stream/package.json create mode 100644 node_modules/concat-stream/readme.md 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-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/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/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/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/define-property/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/define-property/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/define-property/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/define-property/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/define-property/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/define-property/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/define-property/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/define-property/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/define-property/node_modules/is-descriptor/README.md create mode 100644 node_modules/define-property/node_modules/is-descriptor/index.js create mode 100644 node_modules/define-property/node_modules/is-descriptor/package.json create mode 100644 node_modules/define-property/node_modules/isobject/LICENSE create mode 100644 node_modules/define-property/node_modules/isobject/README.md create mode 100644 node_modules/define-property/node_modules/isobject/index.d.ts create mode 100644 node_modules/define-property/node_modules/isobject/index.js create mode 100644 node_modules/define-property/node_modules/isobject/package.json create mode 100644 node_modules/define-property/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/define-property/node_modules/kind-of/LICENSE create mode 100644 node_modules/define-property/node_modules/kind-of/README.md create mode 100644 node_modules/define-property/node_modules/kind-of/index.js create mode 100644 node_modules/define-property/node_modules/kind-of/package.json create mode 100644 node_modules/define-property/package.json create mode 100644 node_modules/error-ex/LICENSE create mode 100644 node_modules/error-ex/README.md create mode 100644 node_modules/error-ex/index.js create mode 100644 node_modules/error-ex/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/esprima/ChangeLog create mode 100644 node_modules/esprima/LICENSE.BSD create mode 100644 node_modules/esprima/README.md create mode 100755 node_modules/esprima/bin/esparse.js create mode 100755 node_modules/esprima/bin/esvalidate.js create mode 100644 node_modules/esprima/dist/esprima.js create mode 100644 node_modules/esprima/package.json create mode 100644 node_modules/expand-brackets/LICENSE create mode 100644 node_modules/expand-brackets/README.md create mode 100644 node_modules/expand-brackets/index.js create mode 100644 node_modules/expand-brackets/package.json create mode 100644 node_modules/expand-range/LICENSE create mode 100644 node_modules/expand-range/README.md create mode 100644 node_modules/expand-range/index.js create mode 100644 node_modules/expand-range/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/extend/.editorconfig create mode 100644 node_modules/extend/.eslintrc create mode 100644 node_modules/extend/.jscs.json create mode 100644 node_modules/extend/.travis.yml create mode 100644 node_modules/extend/CHANGELOG.md create mode 100644 node_modules/extend/LICENSE create mode 100644 node_modules/extend/README.md create mode 100644 node_modules/extend/component.json create mode 100644 node_modules/extend/index.js create mode 100644 node_modules/extend/package.json create mode 100644 node_modules/extglob/LICENSE create mode 100644 node_modules/extglob/README.md create mode 100644 node_modules/extglob/index.js create mode 100644 node_modules/extglob/package.json create mode 100644 node_modules/fault/index.js create mode 100644 node_modules/fault/license create mode 100644 node_modules/fault/package.json create mode 100644 node_modules/fault/readme.md create mode 100644 node_modules/file-uri-to-path/.npmignore create mode 100644 node_modules/file-uri-to-path/.travis.yml create mode 100644 node_modules/file-uri-to-path/History.md create mode 100644 node_modules/file-uri-to-path/LICENSE create mode 100644 node_modules/file-uri-to-path/README.md create mode 100644 node_modules/file-uri-to-path/index.d.ts create mode 100644 node_modules/file-uri-to-path/index.js create mode 100644 node_modules/file-uri-to-path/package.json create mode 100644 node_modules/file-uri-to-path/test/test.js create mode 100644 node_modules/file-uri-to-path/test/tests.json create mode 100644 node_modules/filename-regex/LICENSE create mode 100644 node_modules/filename-regex/README.md create mode 100644 node_modules/filename-regex/index.js create mode 100644 node_modules/filename-regex/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/package.json create mode 100644 node_modules/fn-name/index.js create mode 100644 node_modules/fn-name/license create mode 100644 node_modules/fn-name/package.json create mode 100644 node_modules/fn-name/readme.md 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/for-own/LICENSE create mode 100644 node_modules/for-own/README.md create mode 100644 node_modules/for-own/index.js create mode 100644 node_modules/for-own/package.json create mode 100644 node_modules/format/.npmignore create mode 100644 node_modules/format/Makefile create mode 100644 node_modules/format/Readme.md create mode 100644 node_modules/format/component.json create mode 100644 node_modules/format/format-min.js create mode 100644 node_modules/format/format.js create mode 100644 node_modules/format/package.json create mode 100644 node_modules/format/test_format.js 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/fs.realpath/LICENSE create mode 100644 node_modules/fs.realpath/README.md create mode 100644 node_modules/fs.realpath/index.js create mode 100644 node_modules/fs.realpath/old.js create mode 100644 node_modules/fs.realpath/package.json 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-base/LICENSE create mode 100644 node_modules/glob-base/README.md create mode 100644 node_modules/glob-base/index.js create mode 100644 node_modules/glob-base/package.json create mode 100644 node_modules/glob-parent/.npmignore create mode 100644 node_modules/glob-parent/.travis.yml 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/package.json create mode 100644 node_modules/glob-parent/test.js create mode 100644 node_modules/glob/LICENSE create mode 100644 node_modules/glob/README.md create mode 100644 node_modules/glob/changelog.md create mode 100644 node_modules/glob/common.js create mode 100644 node_modules/glob/glob.js create mode 100644 node_modules/glob/package.json create mode 100644 node_modules/glob/sync.js create mode 100644 node_modules/graceful-fs/LICENSE create mode 100644 node_modules/graceful-fs/README.md create mode 100644 node_modules/graceful-fs/clone.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/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/node_modules/isobject/LICENSE create mode 100644 node_modules/has-value/node_modules/isobject/README.md create mode 100644 node_modules/has-value/node_modules/isobject/index.d.ts create mode 100644 node_modules/has-value/node_modules/isobject/index.js create mode 100644 node_modules/has-value/node_modules/isobject/package.json 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/is-number/LICENSE create mode 100644 node_modules/has-values/node_modules/is-number/README.md create mode 100644 node_modules/has-values/node_modules/is-number/index.js create mode 100644 node_modules/has-values/node_modules/is-number/node_modules/kind-of/LICENSE create mode 100644 node_modules/has-values/node_modules/is-number/node_modules/kind-of/README.md create mode 100644 node_modules/has-values/node_modules/is-number/node_modules/kind-of/index.js create mode 100644 node_modules/has-values/node_modules/is-number/node_modules/kind-of/package.json create mode 100644 node_modules/has-values/node_modules/is-number/package.json 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 100755 node_modules/ignore/README.md create mode 100644 node_modules/ignore/ignore.js create mode 100644 node_modules/ignore/index.d.ts create mode 100644 node_modules/ignore/package.json create mode 100644 node_modules/inflight/LICENSE create mode 100644 node_modules/inflight/README.md create mode 100644 node_modules/inflight/inflight.js create mode 100644 node_modules/inflight/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/irregular-plurals/index.js create mode 100644 node_modules/irregular-plurals/irregular-plurals.json create mode 100644 node_modules/irregular-plurals/license create mode 100644 node_modules/irregular-plurals/package.json create mode 100644 node_modules/irregular-plurals/readme.md 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/package.json create mode 100644 node_modules/is-alphabetical/index.js create mode 100644 node_modules/is-alphabetical/license create mode 100644 node_modules/is-alphabetical/package.json create mode 100644 node_modules/is-alphabetical/readme.md create mode 100644 node_modules/is-alphanumeric/index.js create mode 100644 node_modules/is-alphanumeric/license create mode 100644 node_modules/is-alphanumeric/package.json create mode 100644 node_modules/is-alphanumeric/readme.md create mode 100644 node_modules/is-alphanumerical/index.js create mode 100644 node_modules/is-alphanumerical/license create mode 100644 node_modules/is-alphanumerical/package.json create mode 100644 node_modules/is-alphanumerical/readme.md create mode 100644 node_modules/is-arrayish/.editorconfig create mode 100644 node_modules/is-arrayish/.istanbul.yml create mode 100644 node_modules/is-arrayish/.npmignore create mode 100644 node_modules/is-arrayish/.travis.yml create mode 100644 node_modules/is-arrayish/LICENSE create mode 100644 node_modules/is-arrayish/README.md create mode 100644 node_modules/is-arrayish/index.js create mode 100644 node_modules/is-arrayish/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/package.json create mode 100644 node_modules/is-decimal/index.js create mode 100644 node_modules/is-decimal/license create mode 100644 node_modules/is-decimal/package.json create mode 100644 node_modules/is-decimal/readme.md 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/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-dotfile/LICENSE create mode 100644 node_modules/is-dotfile/README.md create mode 100644 node_modules/is-dotfile/index.js create mode 100644 node_modules/is-dotfile/package.json create mode 100644 node_modules/is-empty/.npmignore create mode 100644 node_modules/is-empty/.travis.yml create mode 100644 node_modules/is-empty/History.md create mode 100644 node_modules/is-empty/Readme.md create mode 100644 node_modules/is-empty/lib/index.js create mode 100644 node_modules/is-empty/package.json create mode 100644 node_modules/is-equal-shallow/LICENSE create mode 100644 node_modules/is-equal-shallow/README.md create mode 100644 node_modules/is-equal-shallow/index.js create mode 100644 node_modules/is-equal-shallow/package.json 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-hexadecimal/index.js create mode 100644 node_modules/is-hexadecimal/license create mode 100644 node_modules/is-hexadecimal/package.json create mode 100644 node_modules/is-hexadecimal/readme.md create mode 100644 node_modules/is-hidden/index.js create mode 100644 node_modules/is-hidden/license create mode 100644 node_modules/is-hidden/package.json create mode 100644 node_modules/is-hidden/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-object/.jscs.json create mode 100644 node_modules/is-object/.npmignore create mode 100644 node_modules/is-object/.testem.json create mode 100644 node_modules/is-object/.travis.yml create mode 100644 node_modules/is-object/LICENSE create mode 100644 node_modules/is-object/README.md create mode 100644 node_modules/is-object/index.js create mode 100644 node_modules/is-object/package.json create mode 100644 node_modules/is-object/test/index.js create mode 100644 node_modules/is-plain-obj/index.js create mode 100644 node_modules/is-plain-obj/license create mode 100644 node_modules/is-plain-obj/package.json create mode 100644 node_modules/is-plain-obj/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/node_modules/isobject/LICENSE create mode 100644 node_modules/is-plain-object/node_modules/isobject/README.md create mode 100644 node_modules/is-plain-object/node_modules/isobject/index.d.ts create mode 100644 node_modules/is-plain-object/node_modules/isobject/index.js create mode 100644 node_modules/is-plain-object/node_modules/isobject/package.json create mode 100644 node_modules/is-plain-object/package.json create mode 100644 node_modules/is-posix-bracket/LICENSE create mode 100644 node_modules/is-posix-bracket/README.md create mode 100644 node_modules/is-posix-bracket/index.js create mode 100644 node_modules/is-posix-bracket/package.json create mode 100644 node_modules/is-primitive/LICENSE create mode 100644 node_modules/is-primitive/README.md create mode 100644 node_modules/is-primitive/index.js create mode 100644 node_modules/is-primitive/package.json create mode 100644 node_modules/is-whitespace-character/index.js create mode 100644 node_modules/is-whitespace-character/license create mode 100644 node_modules/is-whitespace-character/package.json create mode 100644 node_modules/is-whitespace-character/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/is-word-character/index.js create mode 100644 node_modules/is-word-character/license create mode 100644 node_modules/is-word-character/package.json create mode 100644 node_modules/is-word-character/readme.md 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/isobject/LICENSE create mode 100644 node_modules/isobject/README.md create mode 100644 node_modules/isobject/index.js create mode 100644 node_modules/isobject/package.json create mode 100644 node_modules/js-yaml/CHANGELOG.md create mode 100644 node_modules/js-yaml/LICENSE create mode 100644 node_modules/js-yaml/README.md create mode 100755 node_modules/js-yaml/bin/js-yaml.js create mode 100644 node_modules/js-yaml/dist/js-yaml.js create mode 100644 node_modules/js-yaml/dist/js-yaml.min.js create mode 100644 node_modules/js-yaml/index.js create mode 100644 node_modules/js-yaml/lib/js-yaml.js create mode 100644 node_modules/js-yaml/lib/js-yaml/common.js create mode 100644 node_modules/js-yaml/lib/js-yaml/dumper.js create mode 100644 node_modules/js-yaml/lib/js-yaml/exception.js create mode 100644 node_modules/js-yaml/lib/js-yaml/loader.js create mode 100644 node_modules/js-yaml/lib/js-yaml/mark.js create mode 100644 node_modules/js-yaml/lib/js-yaml/schema.js create mode 100644 node_modules/js-yaml/lib/js-yaml/schema/core.js create mode 100644 node_modules/js-yaml/lib/js-yaml/schema/default_full.js create mode 100644 node_modules/js-yaml/lib/js-yaml/schema/default_safe.js create mode 100644 node_modules/js-yaml/lib/js-yaml/schema/failsafe.js create mode 100644 node_modules/js-yaml/lib/js-yaml/schema/json.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/binary.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/bool.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/float.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/int.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/js/function.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/js/regexp.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/js/undefined.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/map.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/merge.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/null.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/omap.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/pairs.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/seq.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/set.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/str.js create mode 100644 node_modules/js-yaml/lib/js-yaml/type/timestamp.js create mode 100644 node_modules/js-yaml/package.json create mode 100644 node_modules/json-parse-better-errors/CHANGELOG.md create mode 100644 node_modules/json-parse-better-errors/LICENSE.md create mode 100644 node_modules/json-parse-better-errors/README.md create mode 100644 node_modules/json-parse-better-errors/index.js create mode 100644 node_modules/json-parse-better-errors/package.json create mode 100644 node_modules/json5/CHANGELOG.md create mode 100644 node_modules/json5/LICENSE.md create mode 100644 node_modules/json5/README.md create mode 100755 node_modules/json5/lib/cli.js create mode 100644 node_modules/json5/lib/json5.js create mode 100644 node_modules/json5/lib/require.js create mode 100644 node_modules/json5/package.json 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/load-plugin/browser.js create mode 100644 node_modules/load-plugin/index.js create mode 100644 node_modules/load-plugin/license create mode 100644 node_modules/load-plugin/package.json create mode 100644 node_modules/load-plugin/readme.md create mode 100644 node_modules/longest-streak/index.js create mode 100644 node_modules/longest-streak/license create mode 100644 node_modules/longest-streak/package.json create mode 100644 node_modules/longest-streak/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-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/markdown-escapes/index.js create mode 100644 node_modules/markdown-escapes/license create mode 100644 node_modules/markdown-escapes/package.json create mode 100644 node_modules/markdown-escapes/readme.md create mode 100644 node_modules/markdown-extensions/index.js create mode 100644 node_modules/markdown-extensions/license create mode 100644 node_modules/markdown-extensions/markdown-extensions.json create mode 100644 node_modules/markdown-extensions/package.json create mode 100644 node_modules/markdown-extensions/readme.md create mode 100644 node_modules/markdown-table/index.js create mode 100644 node_modules/markdown-table/license create mode 100644 node_modules/markdown-table/package.json create mode 100644 node_modules/markdown-table/readme.md create mode 100644 node_modules/math-random/.travis.yml create mode 100644 node_modules/math-random/browser.js create mode 100644 node_modules/math-random/node.js create mode 100644 node_modules/math-random/package.json create mode 100644 node_modules/math-random/readme.md create mode 100644 node_modules/math-random/test.js create mode 100644 node_modules/mdast-comment-marker/index.js create mode 100644 node_modules/mdast-comment-marker/license create mode 100644 node_modules/mdast-comment-marker/package.json create mode 100644 node_modules/mdast-comment-marker/readme.md create mode 100644 node_modules/mdast-util-compact/index.js create mode 100644 node_modules/mdast-util-compact/license create mode 100644 node_modules/mdast-util-compact/package.json create mode 100644 node_modules/mdast-util-compact/readme.md create mode 100644 node_modules/mdast-util-heading-style/index.js create mode 100644 node_modules/mdast-util-heading-style/license create mode 100644 node_modules/mdast-util-heading-style/package.json create mode 100644 node_modules/mdast-util-heading-style/readme.md create mode 100644 node_modules/mdast-util-to-string/index.js create mode 100644 node_modules/mdast-util-to-string/license create mode 100644 node_modules/mdast-util-to-string/package.json create mode 100644 node_modules/mdast-util-to-string/readme.md create mode 100755 node_modules/micromatch/LICENSE create mode 100644 node_modules/micromatch/README.md create mode 100755 node_modules/micromatch/index.js create mode 100644 node_modules/micromatch/lib/chars.js create mode 100644 node_modules/micromatch/lib/expand.js create mode 100644 node_modules/micromatch/lib/glob.js create mode 100644 node_modules/micromatch/lib/utils.js create mode 100644 node_modules/micromatch/package.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/proto.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/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_define_own_property_helper.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/compilers.js create mode 100644 node_modules/nanomatch/lib/parsers.js create mode 100644 node_modules/nanomatch/lib/utils.js create mode 100755 node_modules/nanomatch/node_modules/arr-diff/LICENSE create mode 100644 node_modules/nanomatch/node_modules/arr-diff/README.md create mode 100644 node_modules/nanomatch/node_modules/arr-diff/index.js create mode 100644 node_modules/nanomatch/node_modules/arr-diff/package.json create mode 100755 node_modules/nanomatch/node_modules/array-unique/LICENSE create mode 100755 node_modules/nanomatch/node_modules/array-unique/README.md create mode 100644 node_modules/nanomatch/node_modules/array-unique/index.js create mode 100644 node_modules/nanomatch/node_modules/array-unique/package.json 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/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-prefix/LICENSE create mode 100644 node_modules/npm-prefix/README.md create mode 100644 node_modules/npm-prefix/index.js create mode 100644 node_modules/npm-prefix/package.json create mode 100644 node_modules/number-is-nan/index.js create mode 100644 node_modules/number-is-nan/license create mode 100644 node_modules/number-is-nan/package.json create mode 100644 node_modules/number-is-nan/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/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/node_modules/isobject/LICENSE create mode 100644 node_modules/object-visit/node_modules/isobject/README.md create mode 100644 node_modules/object-visit/node_modules/isobject/index.d.ts create mode 100644 node_modules/object-visit/node_modules/isobject/index.js create mode 100644 node_modules/object-visit/node_modules/isobject/package.json create mode 100644 node_modules/object-visit/package.json create mode 100644 node_modules/object.omit/LICENSE create mode 100644 node_modules/object.omit/README.md create mode 100644 node_modules/object.omit/index.js create mode 100644 node_modules/object.omit/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/node_modules/isobject/LICENSE create mode 100644 node_modules/object.pick/node_modules/isobject/README.md create mode 100644 node_modules/object.pick/node_modules/isobject/index.d.ts create mode 100644 node_modules/object.pick/node_modules/isobject/index.js create mode 100644 node_modules/object.pick/node_modules/isobject/package.json create mode 100644 node_modules/object.pick/package.json create mode 100644 node_modules/once/LICENSE create mode 100644 node_modules/once/README.md create mode 100644 node_modules/once/once.js create mode 100644 node_modules/once/package.json create mode 100644 node_modules/os-homedir/index.js create mode 100644 node_modules/os-homedir/license create mode 100644 node_modules/os-homedir/package.json create mode 100644 node_modules/os-homedir/readme.md create mode 100644 node_modules/parse-entities/decode-entity.browser.js create mode 100644 node_modules/parse-entities/decode-entity.js create mode 100644 node_modules/parse-entities/index.js create mode 100644 node_modules/parse-entities/license create mode 100644 node_modules/parse-entities/package.json create mode 100644 node_modules/parse-entities/readme.md create mode 100644 node_modules/parse-glob/LICENSE create mode 100644 node_modules/parse-glob/README.md create mode 100644 node_modules/parse-glob/index.js create mode 100644 node_modules/parse-glob/package.json create mode 100644 node_modules/parse-json/index.js create mode 100644 node_modules/parse-json/license create mode 100644 node_modules/parse-json/package.json create mode 100644 node_modules/parse-json/readme.md 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-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/plur/index.d.ts create mode 100644 node_modules/plur/index.js create mode 100644 node_modules/plur/license create mode 100644 node_modules/plur/package.json create mode 100644 node_modules/plur/readme.md create mode 100644 node_modules/pluralize/LICENSE create mode 100644 node_modules/pluralize/Readme.md create mode 100644 node_modules/pluralize/package.json create mode 100644 node_modules/pluralize/pluralize.js 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/preserve/.gitattributes create mode 100644 node_modules/preserve/.jshintrc create mode 100644 node_modules/preserve/.npmignore create mode 100644 node_modules/preserve/.travis.yml create mode 100644 node_modules/preserve/.verb.md create mode 100644 node_modules/preserve/LICENSE create mode 100644 node_modules/preserve/README.md create mode 100644 node_modules/preserve/index.js create mode 100644 node_modules/preserve/package.json create mode 100644 node_modules/preserve/test.js 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/randomatic/LICENSE create mode 100644 node_modules/randomatic/README.md create mode 100644 node_modules/randomatic/index.js create mode 100644 node_modules/randomatic/node_modules/is-number/LICENSE create mode 100644 node_modules/randomatic/node_modules/is-number/README.md create mode 100644 node_modules/randomatic/node_modules/is-number/index.js create mode 100644 node_modules/randomatic/node_modules/is-number/package.json create mode 100644 node_modules/randomatic/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/randomatic/node_modules/kind-of/LICENSE create mode 100644 node_modules/randomatic/node_modules/kind-of/README.md create mode 100644 node_modules/randomatic/node_modules/kind-of/index.js create mode 100644 node_modules/randomatic/node_modules/kind-of/package.json create mode 100644 node_modules/randomatic/package.json 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/LICENSE create mode 100644 node_modules/readdirp/README.md create mode 100755 node_modules/readdirp/node_modules/arr-diff/LICENSE create mode 100644 node_modules/readdirp/node_modules/arr-diff/README.md create mode 100644 node_modules/readdirp/node_modules/arr-diff/index.js create mode 100644 node_modules/readdirp/node_modules/arr-diff/package.json create mode 100755 node_modules/readdirp/node_modules/array-unique/LICENSE create mode 100755 node_modules/readdirp/node_modules/array-unique/README.md create mode 100644 node_modules/readdirp/node_modules/array-unique/index.js create mode 100644 node_modules/readdirp/node_modules/array-unique/package.json create mode 100644 node_modules/readdirp/node_modules/braces/LICENSE create mode 100644 node_modules/readdirp/node_modules/braces/README.md create mode 100644 node_modules/readdirp/node_modules/braces/index.js create mode 100644 node_modules/readdirp/node_modules/braces/lib/braces.js create mode 100644 node_modules/readdirp/node_modules/braces/lib/compilers.js create mode 100644 node_modules/readdirp/node_modules/braces/lib/parsers.js create mode 100644 node_modules/readdirp/node_modules/braces/lib/utils.js create mode 100644 node_modules/readdirp/node_modules/braces/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/readdirp/node_modules/braces/node_modules/extend-shallow/README.md create mode 100644 node_modules/readdirp/node_modules/braces/node_modules/extend-shallow/index.js create mode 100644 node_modules/readdirp/node_modules/braces/node_modules/extend-shallow/package.json create mode 100644 node_modules/readdirp/node_modules/braces/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/changelog.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/lib/compilers.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/lib/parsers.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/lib/utils.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/kind-of/LICENSE create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/kind-of/README.md create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/kind-of/index.js create mode 100644 node_modules/readdirp/node_modules/expand-brackets/node_modules/kind-of/package.json create mode 100644 node_modules/readdirp/node_modules/expand-brackets/package.json create mode 100644 node_modules/readdirp/node_modules/extglob/LICENSE create mode 100644 node_modules/readdirp/node_modules/extglob/README.md create mode 100644 node_modules/readdirp/node_modules/extglob/changelog.md create mode 100644 node_modules/readdirp/node_modules/extglob/index.js create mode 100644 node_modules/readdirp/node_modules/extglob/lib/compilers.js create mode 100644 node_modules/readdirp/node_modules/extglob/lib/extglob.js create mode 100644 node_modules/readdirp/node_modules/extglob/lib/parsers.js create mode 100644 node_modules/readdirp/node_modules/extglob/lib/utils.js create mode 100644 node_modules/readdirp/node_modules/extglob/node_modules/define-property/LICENSE create mode 100644 node_modules/readdirp/node_modules/extglob/node_modules/define-property/README.md create mode 100644 node_modules/readdirp/node_modules/extglob/node_modules/define-property/index.js create mode 100644 node_modules/readdirp/node_modules/extglob/node_modules/define-property/package.json create mode 100644 node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow/README.md create mode 100644 node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow/index.js create mode 100644 node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow/package.json create mode 100644 node_modules/readdirp/node_modules/extglob/package.json create mode 100644 node_modules/readdirp/node_modules/fill-range/LICENSE create mode 100644 node_modules/readdirp/node_modules/fill-range/README.md create mode 100644 node_modules/readdirp/node_modules/fill-range/index.js create mode 100644 node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/LICENSE create mode 100644 node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/README.md create mode 100644 node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/index.js create mode 100644 node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/package.json create mode 100644 node_modules/readdirp/node_modules/fill-range/package.json create mode 100644 node_modules/readdirp/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/readdirp/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/readdirp/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/readdirp/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/readdirp/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/readdirp/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/readdirp/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/readdirp/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/readdirp/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/readdirp/node_modules/is-descriptor/README.md create mode 100644 node_modules/readdirp/node_modules/is-descriptor/index.js create mode 100644 node_modules/readdirp/node_modules/is-descriptor/package.json create mode 100644 node_modules/readdirp/node_modules/is-number/LICENSE create mode 100644 node_modules/readdirp/node_modules/is-number/README.md create mode 100644 node_modules/readdirp/node_modules/is-number/index.js create mode 100644 node_modules/readdirp/node_modules/is-number/node_modules/kind-of/LICENSE create mode 100644 node_modules/readdirp/node_modules/is-number/node_modules/kind-of/README.md create mode 100644 node_modules/readdirp/node_modules/is-number/node_modules/kind-of/index.js create mode 100644 node_modules/readdirp/node_modules/is-number/node_modules/kind-of/package.json create mode 100644 node_modules/readdirp/node_modules/is-number/package.json create mode 100644 node_modules/readdirp/node_modules/isobject/LICENSE create mode 100644 node_modules/readdirp/node_modules/isobject/README.md create mode 100644 node_modules/readdirp/node_modules/isobject/index.d.ts create mode 100644 node_modules/readdirp/node_modules/isobject/index.js create mode 100644 node_modules/readdirp/node_modules/isobject/package.json create mode 100644 node_modules/readdirp/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/readdirp/node_modules/kind-of/LICENSE create mode 100644 node_modules/readdirp/node_modules/kind-of/README.md create mode 100644 node_modules/readdirp/node_modules/kind-of/index.js create mode 100644 node_modules/readdirp/node_modules/kind-of/package.json create mode 100644 node_modules/readdirp/node_modules/micromatch/CHANGELOG.md create mode 100755 node_modules/readdirp/node_modules/micromatch/LICENSE create mode 100644 node_modules/readdirp/node_modules/micromatch/README.md create mode 100644 node_modules/readdirp/node_modules/micromatch/index.js create mode 100644 node_modules/readdirp/node_modules/micromatch/lib/cache.js create mode 100644 node_modules/readdirp/node_modules/micromatch/lib/compilers.js create mode 100644 node_modules/readdirp/node_modules/micromatch/lib/parsers.js create mode 100644 node_modules/readdirp/node_modules/micromatch/lib/utils.js create mode 100644 node_modules/readdirp/node_modules/micromatch/package.json 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/regex-cache/LICENSE create mode 100644 node_modules/regex-cache/README.md create mode 100644 node_modules/regex-cache/index.js create mode 100644 node_modules/regex-cache/package.json 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 100755 node_modules/remark-cli/cli.js create mode 100644 node_modules/remark-cli/package.json create mode 100644 node_modules/remark-cli/readme.md create mode 100644 node_modules/remark-lint-blockquote-indentation/index.js create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-blockquote-indentation/package.json create mode 100644 node_modules/remark-lint-blockquote-indentation/readme.md create mode 100644 node_modules/remark-lint-checkbox-character-style/index.js create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/index.js create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/license create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/package.json create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/readme.md create mode 100644 node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/types/index.d.ts create mode 100644 node_modules/remark-lint-checkbox-character-style/package.json create mode 100644 node_modules/remark-lint-checkbox-character-style/readme.md create mode 100644 node_modules/remark-lint-code-block-style/index.js create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-code-block-style/package.json create mode 100644 node_modules/remark-lint-code-block-style/readme.md create mode 100644 node_modules/remark-lint-definition-case/index.js create mode 100644 node_modules/remark-lint-definition-case/package.json create mode 100644 node_modules/remark-lint-definition-case/readme.md create mode 100644 node_modules/remark-lint-definition-spacing/index.js create mode 100644 node_modules/remark-lint-definition-spacing/package.json create mode 100644 node_modules/remark-lint-definition-spacing/readme.md create mode 100644 node_modules/remark-lint-emphasis-marker/index.js create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-emphasis-marker/package.json create mode 100644 node_modules/remark-lint-emphasis-marker/readme.md create mode 100644 node_modules/remark-lint-fenced-code-flag/index.js create mode 100644 node_modules/remark-lint-fenced-code-flag/package.json create mode 100644 node_modules/remark-lint-fenced-code-flag/readme.md create mode 100644 node_modules/remark-lint-fenced-code-marker/index.js create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-fenced-code-marker/package.json create mode 100644 node_modules/remark-lint-fenced-code-marker/readme.md create mode 100644 node_modules/remark-lint-file-extension/index.js create mode 100644 node_modules/remark-lint-file-extension/package.json create mode 100644 node_modules/remark-lint-file-extension/readme.md create mode 100644 node_modules/remark-lint-final-definition/index.js create mode 100644 node_modules/remark-lint-final-definition/package.json create mode 100644 node_modules/remark-lint-final-definition/readme.md create mode 100644 node_modules/remark-lint-final-newline/index.js create mode 100644 node_modules/remark-lint-final-newline/package.json create mode 100644 node_modules/remark-lint-final-newline/readme.md create mode 100644 node_modules/remark-lint-hard-break-spaces/index.js create mode 100644 node_modules/remark-lint-hard-break-spaces/package.json create mode 100644 node_modules/remark-lint-hard-break-spaces/readme.md create mode 100644 node_modules/remark-lint-heading-increment/index.js create mode 100644 node_modules/remark-lint-heading-increment/package.json create mode 100644 node_modules/remark-lint-heading-increment/readme.md create mode 100644 node_modules/remark-lint-heading-style/index.js create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-heading-style/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-heading-style/package.json create mode 100644 node_modules/remark-lint-heading-style/readme.md create mode 100644 node_modules/remark-lint-link-title-style/index.js create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-link-title-style/node_modules/vfile-location/index.js create mode 100644 node_modules/remark-lint-link-title-style/node_modules/vfile-location/license create mode 100644 node_modules/remark-lint-link-title-style/node_modules/vfile-location/package.json create mode 100644 node_modules/remark-lint-link-title-style/node_modules/vfile-location/readme.md create mode 100644 node_modules/remark-lint-link-title-style/node_modules/vfile-location/types/index.d.ts create mode 100644 node_modules/remark-lint-link-title-style/package.json create mode 100644 node_modules/remark-lint-link-title-style/readme.md create mode 100644 node_modules/remark-lint-list-item-bullet-indent/index.js create mode 100644 node_modules/remark-lint-list-item-bullet-indent/package.json create mode 100644 node_modules/remark-lint-list-item-bullet-indent/readme.md create mode 100644 node_modules/remark-lint-list-item-content-indent/index.js create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-list-item-content-indent/package.json create mode 100644 node_modules/remark-lint-list-item-content-indent/readme.md create mode 100644 node_modules/remark-lint-list-item-indent/index.js create mode 100644 node_modules/remark-lint-list-item-indent/package.json create mode 100644 node_modules/remark-lint-list-item-indent/readme.md create mode 100644 node_modules/remark-lint-list-item-spacing/index.js create mode 100644 node_modules/remark-lint-list-item-spacing/package.json create mode 100644 node_modules/remark-lint-list-item-spacing/readme.md create mode 100644 node_modules/remark-lint-maximum-heading-length/index.js create mode 100644 node_modules/remark-lint-maximum-heading-length/package.json create mode 100644 node_modules/remark-lint-maximum-heading-length/readme.md create mode 100644 node_modules/remark-lint-maximum-line-length/index.js create mode 100644 node_modules/remark-lint-maximum-line-length/package.json create mode 100644 node_modules/remark-lint-maximum-line-length/readme.md create mode 100644 node_modules/remark-lint-no-auto-link-without-protocol/index.js create mode 100644 node_modules/remark-lint-no-auto-link-without-protocol/package.json create mode 100644 node_modules/remark-lint-no-auto-link-without-protocol/readme.md create mode 100644 node_modules/remark-lint-no-blockquote-without-marker/index.js create mode 100644 node_modules/remark-lint-no-blockquote-without-marker/package.json create mode 100644 node_modules/remark-lint-no-blockquote-without-marker/readme.md create mode 100644 node_modules/remark-lint-no-consecutive-blank-lines/index.js create mode 100644 node_modules/remark-lint-no-consecutive-blank-lines/package.json create mode 100644 node_modules/remark-lint-no-consecutive-blank-lines/readme.md create mode 100644 node_modules/remark-lint-no-duplicate-definitions/index.js create mode 100644 node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/index.js create mode 100644 node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/license create mode 100644 node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/package.json create mode 100644 node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/readme.md create mode 100644 node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/types/index.d.ts create mode 100644 node_modules/remark-lint-no-duplicate-definitions/package.json create mode 100644 node_modules/remark-lint-no-duplicate-definitions/readme.md create mode 100644 node_modules/remark-lint-no-duplicate-headings/index.js create mode 100644 node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/index.js create mode 100644 node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/license create mode 100644 node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/package.json create mode 100644 node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/readme.md create mode 100644 node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/types/index.d.ts create mode 100644 node_modules/remark-lint-no-duplicate-headings/package.json create mode 100644 node_modules/remark-lint-no-duplicate-headings/readme.md create mode 100644 node_modules/remark-lint-no-emphasis-as-heading/index.js create mode 100644 node_modules/remark-lint-no-emphasis-as-heading/package.json create mode 100644 node_modules/remark-lint-no-emphasis-as-heading/readme.md create mode 100644 node_modules/remark-lint-no-file-name-articles/index.js create mode 100644 node_modules/remark-lint-no-file-name-articles/package.json create mode 100644 node_modules/remark-lint-no-file-name-articles/readme.md create mode 100644 node_modules/remark-lint-no-file-name-consecutive-dashes/index.js create mode 100644 node_modules/remark-lint-no-file-name-consecutive-dashes/package.json create mode 100644 node_modules/remark-lint-no-file-name-consecutive-dashes/readme.md create mode 100644 node_modules/remark-lint-no-file-name-irregular-characters/index.js create mode 100644 node_modules/remark-lint-no-file-name-irregular-characters/package.json create mode 100644 node_modules/remark-lint-no-file-name-irregular-characters/readme.md create mode 100644 node_modules/remark-lint-no-file-name-mixed-case/index.js create mode 100644 node_modules/remark-lint-no-file-name-mixed-case/package.json create mode 100644 node_modules/remark-lint-no-file-name-mixed-case/readme.md create mode 100644 node_modules/remark-lint-no-file-name-outer-dashes/index.js create mode 100644 node_modules/remark-lint-no-file-name-outer-dashes/package.json create mode 100644 node_modules/remark-lint-no-file-name-outer-dashes/readme.md create mode 100644 node_modules/remark-lint-no-heading-content-indent/index.js create mode 100644 node_modules/remark-lint-no-heading-content-indent/package.json create mode 100644 node_modules/remark-lint-no-heading-content-indent/readme.md create mode 100644 node_modules/remark-lint-no-heading-punctuation/index.js create mode 100644 node_modules/remark-lint-no-heading-punctuation/package.json create mode 100644 node_modules/remark-lint-no-heading-punctuation/readme.md create mode 100644 node_modules/remark-lint-no-inline-padding/index.js create mode 100644 node_modules/remark-lint-no-inline-padding/package.json create mode 100644 node_modules/remark-lint-no-inline-padding/readme.md create mode 100644 node_modules/remark-lint-no-literal-urls/index.js create mode 100644 node_modules/remark-lint-no-literal-urls/package.json create mode 100644 node_modules/remark-lint-no-literal-urls/readme.md create mode 100644 node_modules/remark-lint-no-multiple-toplevel-headings/index.js create mode 100644 node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/index.js create mode 100644 node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/license create mode 100644 node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/package.json create mode 100644 node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/readme.md create mode 100644 node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/types/index.d.ts create mode 100644 node_modules/remark-lint-no-multiple-toplevel-headings/package.json create mode 100644 node_modules/remark-lint-no-multiple-toplevel-headings/readme.md create mode 100644 node_modules/remark-lint-no-shell-dollars/index.js create mode 100644 node_modules/remark-lint-no-shell-dollars/package.json create mode 100644 node_modules/remark-lint-no-shell-dollars/readme.md create mode 100644 node_modules/remark-lint-no-shortcut-reference-image/index.js create mode 100644 node_modules/remark-lint-no-shortcut-reference-image/package.json create mode 100644 node_modules/remark-lint-no-shortcut-reference-image/readme.md create mode 100644 node_modules/remark-lint-no-shortcut-reference-link/index.js create mode 100644 node_modules/remark-lint-no-shortcut-reference-link/package.json create mode 100644 node_modules/remark-lint-no-shortcut-reference-link/readme.md create mode 100644 node_modules/remark-lint-no-table-indentation/index.js create mode 100644 node_modules/remark-lint-no-table-indentation/package.json create mode 100644 node_modules/remark-lint-no-table-indentation/readme.md create mode 100644 node_modules/remark-lint-no-undefined-references/index.js create mode 100644 node_modules/remark-lint-no-undefined-references/package.json create mode 100644 node_modules/remark-lint-no-undefined-references/readme.md create mode 100644 node_modules/remark-lint-no-unused-definitions/index.js create mode 100644 node_modules/remark-lint-no-unused-definitions/package.json create mode 100644 node_modules/remark-lint-no-unused-definitions/readme.md create mode 100644 node_modules/remark-lint-ordered-list-marker-style/index.js create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-ordered-list-marker-style/package.json create mode 100644 node_modules/remark-lint-ordered-list-marker-style/readme.md create mode 100644 node_modules/remark-lint-ordered-list-marker-value/index.js create mode 100644 node_modules/remark-lint-ordered-list-marker-value/package.json create mode 100644 node_modules/remark-lint-ordered-list-marker-value/readme.md create mode 100644 node_modules/remark-lint-rule-style/index.js create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-rule-style/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-rule-style/package.json create mode 100644 node_modules/remark-lint-rule-style/readme.md create mode 100644 node_modules/remark-lint-strong-marker/index.js create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-strong-marker/package.json create mode 100644 node_modules/remark-lint-strong-marker/readme.md create mode 100644 node_modules/remark-lint-table-cell-padding/index.js create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/license create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-lint-table-cell-padding/package.json create mode 100644 node_modules/remark-lint-table-cell-padding/readme.md create mode 100644 node_modules/remark-lint-table-pipe-alignment/index.js create mode 100644 node_modules/remark-lint-table-pipe-alignment/package.json create mode 100644 node_modules/remark-lint-table-pipe-alignment/readme.md create mode 100644 node_modules/remark-lint-table-pipes/index.js create mode 100644 node_modules/remark-lint-table-pipes/package.json create mode 100644 node_modules/remark-lint-table-pipes/readme.md create mode 100644 node_modules/remark-lint-unordered-list-marker-style/index.js create mode 100644 node_modules/remark-lint-unordered-list-marker-style/package.json create mode 100644 node_modules/remark-lint-unordered-list-marker-style/readme.md create mode 100644 node_modules/remark-lint/index.js create mode 100644 node_modules/remark-lint/package.json create mode 100644 node_modules/remark-lint/readme.md create mode 100644 node_modules/remark-message-control/index.js create mode 100644 node_modules/remark-message-control/license create mode 100644 node_modules/remark-message-control/package.json create mode 100644 node_modules/remark-message-control/readme.md create mode 100644 node_modules/remark-parse/index.js create mode 100644 node_modules/remark-parse/lib/block-elements.json create mode 100644 node_modules/remark-parse/lib/decode.js create mode 100644 node_modules/remark-parse/lib/defaults.js create mode 100644 node_modules/remark-parse/lib/locate/break.js create mode 100644 node_modules/remark-parse/lib/locate/code-inline.js create mode 100644 node_modules/remark-parse/lib/locate/delete.js create mode 100644 node_modules/remark-parse/lib/locate/emphasis.js create mode 100644 node_modules/remark-parse/lib/locate/escape.js create mode 100644 node_modules/remark-parse/lib/locate/link.js create mode 100644 node_modules/remark-parse/lib/locate/strong.js create mode 100644 node_modules/remark-parse/lib/locate/tag.js create mode 100644 node_modules/remark-parse/lib/locate/url.js create mode 100644 node_modules/remark-parse/lib/parse.js create mode 100644 node_modules/remark-parse/lib/parser.js create mode 100644 node_modules/remark-parse/lib/set-options.js create mode 100644 node_modules/remark-parse/lib/tokenize/auto-link.js create mode 100644 node_modules/remark-parse/lib/tokenize/blockquote.js create mode 100644 node_modules/remark-parse/lib/tokenize/break.js create mode 100644 node_modules/remark-parse/lib/tokenize/code-fenced.js create mode 100644 node_modules/remark-parse/lib/tokenize/code-indented.js create mode 100644 node_modules/remark-parse/lib/tokenize/code-inline.js create mode 100644 node_modules/remark-parse/lib/tokenize/definition.js create mode 100644 node_modules/remark-parse/lib/tokenize/delete.js create mode 100644 node_modules/remark-parse/lib/tokenize/emphasis.js create mode 100644 node_modules/remark-parse/lib/tokenize/escape.js create mode 100644 node_modules/remark-parse/lib/tokenize/footnote-definition.js create mode 100644 node_modules/remark-parse/lib/tokenize/heading-atx.js create mode 100644 node_modules/remark-parse/lib/tokenize/heading-setext.js create mode 100644 node_modules/remark-parse/lib/tokenize/html-block.js create mode 100644 node_modules/remark-parse/lib/tokenize/html-inline.js create mode 100644 node_modules/remark-parse/lib/tokenize/link.js create mode 100644 node_modules/remark-parse/lib/tokenize/list.js create mode 100644 node_modules/remark-parse/lib/tokenize/newline.js create mode 100644 node_modules/remark-parse/lib/tokenize/paragraph.js create mode 100644 node_modules/remark-parse/lib/tokenize/reference.js create mode 100644 node_modules/remark-parse/lib/tokenize/strong.js create mode 100644 node_modules/remark-parse/lib/tokenize/table.js create mode 100644 node_modules/remark-parse/lib/tokenize/text.js create mode 100644 node_modules/remark-parse/lib/tokenize/thematic-break.js create mode 100644 node_modules/remark-parse/lib/tokenize/url.js create mode 100644 node_modules/remark-parse/lib/tokenizer.js create mode 100644 node_modules/remark-parse/lib/unescape.js create mode 100644 node_modules/remark-parse/lib/util/get-indentation.js create mode 100644 node_modules/remark-parse/lib/util/html.js create mode 100644 node_modules/remark-parse/lib/util/interrupt.js create mode 100644 node_modules/remark-parse/lib/util/normalize.js create mode 100644 node_modules/remark-parse/lib/util/remove-indentation.js create mode 100644 node_modules/remark-parse/package.json create mode 100644 node_modules/remark-parse/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-lint/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/license create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/index.d.ts create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/license create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/convert.d.ts create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/convert.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/index.d.ts create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/license create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/color.browser.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/color.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/license create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/types/index.d.ts create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/license create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/types/index.d.ts create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/vfile-location/index.js create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/vfile-location/license create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/vfile-location/package.json create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/vfile-location/readme.md create mode 100644 node_modules/remark-preset-lint-consistent/node_modules/vfile-location/types/index.d.ts create mode 100644 node_modules/remark-preset-lint-consistent/package.json create mode 100644 node_modules/remark-preset-lint-consistent/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/index.js create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/readme.md create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/package.json create mode 100644 node_modules/remark-preset-lint-markdown-style-guide/readme.md create mode 100644 node_modules/remark-preset-lint-recommended/index.js create mode 100644 node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/index.js create mode 100644 node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/package.json create mode 100644 node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/readme.md create mode 100644 node_modules/remark-preset-lint-recommended/package.json create mode 100644 node_modules/remark-preset-lint-recommended/readme.md create mode 100644 node_modules/remark-stringify/index.js create mode 100644 node_modules/remark-stringify/lib/compiler.js create mode 100644 node_modules/remark-stringify/lib/defaults.js create mode 100644 node_modules/remark-stringify/lib/escape.js create mode 100644 node_modules/remark-stringify/lib/macro/all.js create mode 100644 node_modules/remark-stringify/lib/macro/block.js create mode 100644 node_modules/remark-stringify/lib/macro/compile.js create mode 100644 node_modules/remark-stringify/lib/macro/one.js create mode 100644 node_modules/remark-stringify/lib/macro/ordered-items.js create mode 100644 node_modules/remark-stringify/lib/macro/unordered-items.js create mode 100644 node_modules/remark-stringify/lib/set-options.js create mode 100644 node_modules/remark-stringify/lib/util/copy-identifier-encoding.js create mode 100644 node_modules/remark-stringify/lib/util/enclose-title.js create mode 100644 node_modules/remark-stringify/lib/util/enclose-uri.js create mode 100644 node_modules/remark-stringify/lib/util/enter-link-reference.js create mode 100644 node_modules/remark-stringify/lib/util/entity-prefix-length.js create mode 100644 node_modules/remark-stringify/lib/util/label.js create mode 100644 node_modules/remark-stringify/lib/util/pad.js create mode 100644 node_modules/remark-stringify/lib/util/returner.js create mode 100644 node_modules/remark-stringify/lib/visitors/blockquote.js create mode 100644 node_modules/remark-stringify/lib/visitors/break.js create mode 100644 node_modules/remark-stringify/lib/visitors/code.js create mode 100644 node_modules/remark-stringify/lib/visitors/definition.js create mode 100644 node_modules/remark-stringify/lib/visitors/delete.js create mode 100644 node_modules/remark-stringify/lib/visitors/emphasis.js create mode 100644 node_modules/remark-stringify/lib/visitors/footnote-definition.js create mode 100644 node_modules/remark-stringify/lib/visitors/footnote-reference.js create mode 100644 node_modules/remark-stringify/lib/visitors/footnote.js create mode 100644 node_modules/remark-stringify/lib/visitors/heading.js create mode 100644 node_modules/remark-stringify/lib/visitors/html.js create mode 100644 node_modules/remark-stringify/lib/visitors/image-reference.js create mode 100644 node_modules/remark-stringify/lib/visitors/image.js create mode 100644 node_modules/remark-stringify/lib/visitors/inline-code.js create mode 100644 node_modules/remark-stringify/lib/visitors/link-reference.js create mode 100644 node_modules/remark-stringify/lib/visitors/link.js create mode 100644 node_modules/remark-stringify/lib/visitors/list-item.js create mode 100644 node_modules/remark-stringify/lib/visitors/list.js create mode 100644 node_modules/remark-stringify/lib/visitors/paragraph.js create mode 100644 node_modules/remark-stringify/lib/visitors/root.js create mode 100644 node_modules/remark-stringify/lib/visitors/strong.js create mode 100644 node_modules/remark-stringify/lib/visitors/table-cell.js create mode 100644 node_modules/remark-stringify/lib/visitors/table.js create mode 100644 node_modules/remark-stringify/lib/visitors/text.js create mode 100644 node_modules/remark-stringify/lib/visitors/thematic-break.js create mode 100644 node_modules/remark-stringify/package.json create mode 100644 node_modules/remark-stringify/readme.md create mode 100644 node_modules/remark/index.js create mode 100644 node_modules/remark/package.json create mode 100644 node_modules/remark/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 100755 node_modules/replace-ext/LICENSE create mode 100644 node_modules/replace-ext/README.md create mode 100644 node_modules/replace-ext/index.js create mode 100644 node_modules/replace-ext/package.json create mode 100644 node_modules/resolve-from/index.d.ts 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/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/safe-buffer/LICENSE create mode 100644 node_modules/safe-buffer/README.md create mode 100644 node_modules/safe-buffer/index.d.ts create mode 100644 node_modules/safe-buffer/index.js create mode 100644 node_modules/safe-buffer/package.json 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/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/shellsubstitute/.npmignore create mode 100644 node_modules/shellsubstitute/.travis.yml create mode 100644 node_modules/shellsubstitute/index.js create mode 100644 node_modules/shellsubstitute/package.json create mode 100644 node_modules/shellsubstitute/readme.md create mode 100644 node_modules/shellsubstitute/test/spec.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/node_modules/is-accessor-descriptor/LICENSE create mode 100644 node_modules/snapdragon-node/node_modules/is-accessor-descriptor/README.md create mode 100644 node_modules/snapdragon-node/node_modules/is-accessor-descriptor/index.js create mode 100644 node_modules/snapdragon-node/node_modules/is-accessor-descriptor/package.json create mode 100644 node_modules/snapdragon-node/node_modules/is-data-descriptor/LICENSE create mode 100644 node_modules/snapdragon-node/node_modules/is-data-descriptor/README.md create mode 100644 node_modules/snapdragon-node/node_modules/is-data-descriptor/index.js create mode 100644 node_modules/snapdragon-node/node_modules/is-data-descriptor/package.json create mode 100644 node_modules/snapdragon-node/node_modules/is-descriptor/LICENSE create mode 100644 node_modules/snapdragon-node/node_modules/is-descriptor/README.md create mode 100644 node_modules/snapdragon-node/node_modules/is-descriptor/index.js create mode 100644 node_modules/snapdragon-node/node_modules/is-descriptor/package.json create mode 100644 node_modules/snapdragon-node/node_modules/isobject/LICENSE create mode 100644 node_modules/snapdragon-node/node_modules/isobject/README.md create mode 100644 node_modules/snapdragon-node/node_modules/isobject/index.d.ts create mode 100644 node_modules/snapdragon-node/node_modules/isobject/index.js create mode 100644 node_modules/snapdragon-node/node_modules/isobject/package.json create mode 100644 node_modules/snapdragon-node/node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/snapdragon-node/node_modules/kind-of/LICENSE create mode 100644 node_modules/snapdragon-node/node_modules/kind-of/README.md create mode 100644 node_modules/snapdragon-node/node_modules/kind-of/index.js create mode 100644 node_modules/snapdragon-node/node_modules/kind-of/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/package.json create mode 100644 node_modules/source-map-resolve/LICENSE create mode 100644 node_modules/source-map-resolve/changelog.md 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-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/CHANGELOG.md create mode 100644 node_modules/source-map/LICENSE create mode 100644 node_modules/source-map/README.md create mode 100644 node_modules/source-map/dist/source-map.debug.js create mode 100644 node_modules/source-map/dist/source-map.js create mode 100644 node_modules/source-map/dist/source-map.min.js create mode 100644 node_modules/source-map/dist/source-map.min.js.map create mode 100644 node_modules/source-map/lib/array-set.js create mode 100644 node_modules/source-map/lib/base64-vlq.js create mode 100644 node_modules/source-map/lib/base64.js create mode 100644 node_modules/source-map/lib/binary-search.js create mode 100644 node_modules/source-map/lib/mapping-list.js create mode 100644 node_modules/source-map/lib/quick-sort.js create mode 100644 node_modules/source-map/lib/source-map-consumer.js create mode 100644 node_modules/source-map/lib/source-map-generator.js create mode 100644 node_modules/source-map/lib/source-node.js create mode 100644 node_modules/source-map/lib/util.js create mode 100644 node_modules/source-map/package.json create mode 100644 node_modules/source-map/source-map.js 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/sprintf-js/.npmignore create mode 100644 node_modules/sprintf-js/LICENSE create mode 100644 node_modules/sprintf-js/README.md create mode 100644 node_modules/sprintf-js/bower.json create mode 100644 node_modules/sprintf-js/demo/angular.html create mode 100644 node_modules/sprintf-js/dist/angular-sprintf.min.js create mode 100644 node_modules/sprintf-js/dist/angular-sprintf.min.js.map create mode 100644 node_modules/sprintf-js/dist/angular-sprintf.min.map create mode 100644 node_modules/sprintf-js/dist/sprintf.min.js create mode 100644 node_modules/sprintf-js/dist/sprintf.min.js.map create mode 100644 node_modules/sprintf-js/dist/sprintf.min.map create mode 100644 node_modules/sprintf-js/gruntfile.js create mode 100644 node_modules/sprintf-js/package.json create mode 100644 node_modules/sprintf-js/src/angular-sprintf.js create mode 100644 node_modules/sprintf-js/src/sprintf.js create mode 100644 node_modules/sprintf-js/test/test.js create mode 100644 node_modules/state-toggle/index.js create mode 100644 node_modules/state-toggle/license create mode 100644 node_modules/state-toggle/package.json create mode 100644 node_modules/state-toggle/readme.md 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/package.json 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/.travis.yml 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/stringify-entities/LICENSE create mode 100644 node_modules/stringify-entities/dangerous.json create mode 100644 node_modules/stringify-entities/index.js create mode 100644 node_modules/stringify-entities/package.json create mode 100644 node_modules/stringify-entities/readme.md 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-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/text-table/.travis.yml create mode 100644 node_modules/text-table/LICENSE create mode 100644 node_modules/text-table/example/align.js create mode 100644 node_modules/text-table/example/center.js create mode 100644 node_modules/text-table/example/dotalign.js create mode 100644 node_modules/text-table/example/doubledot.js create mode 100644 node_modules/text-table/example/table.js create mode 100644 node_modules/text-table/index.js create mode 100644 node_modules/text-table/package.json create mode 100644 node_modules/text-table/readme.markdown create mode 100644 node_modules/text-table/test/align.js create mode 100644 node_modules/text-table/test/ansi-colors.js create mode 100644 node_modules/text-table/test/center.js create mode 100644 node_modules/text-table/test/dotalign.js create mode 100644 node_modules/text-table/test/doubledot.js create mode 100644 node_modules/text-table/test/table.js 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/node_modules/is-number/LICENSE create mode 100644 node_modules/to-regex-range/node_modules/is-number/README.md create mode 100644 node_modules/to-regex-range/node_modules/is-number/index.js create mode 100644 node_modules/to-regex-range/node_modules/is-number/package.json 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/to-vfile/LICENSE create mode 100644 node_modules/to-vfile/index.js create mode 100644 node_modules/to-vfile/lib/core.js create mode 100644 node_modules/to-vfile/lib/fs.js create mode 100644 node_modules/to-vfile/package.json create mode 100644 node_modules/to-vfile/readme.md create mode 100644 node_modules/trim-trailing-lines/index.js create mode 100644 node_modules/trim-trailing-lines/license create mode 100644 node_modules/trim-trailing-lines/package.json create mode 100644 node_modules/trim-trailing-lines/readme.md create mode 100644 node_modules/trim/.npmignore create mode 100644 node_modules/trim/History.md create mode 100644 node_modules/trim/Makefile create mode 100644 node_modules/trim/Readme.md create mode 100644 node_modules/trim/component.json create mode 100644 node_modules/trim/index.js create mode 100644 node_modules/trim/package.json create mode 100644 node_modules/trough/index.js create mode 100644 node_modules/trough/license create mode 100644 node_modules/trough/package.json create mode 100644 node_modules/trough/readme.md create mode 100644 node_modules/trough/wrap.js create mode 100644 node_modules/typedarray/.travis.yml create mode 100644 node_modules/typedarray/LICENSE create mode 100644 node_modules/typedarray/example/tarray.js create mode 100644 node_modules/typedarray/index.js create mode 100644 node_modules/typedarray/package.json create mode 100644 node_modules/typedarray/readme.markdown create mode 100644 node_modules/typedarray/test/server/undef_globals.js create mode 100644 node_modules/typedarray/test/tarray.js create mode 100644 node_modules/unherit/index.js create mode 100644 node_modules/unherit/license create mode 100644 node_modules/unherit/package.json create mode 100644 node_modules/unherit/readme.md create mode 100644 node_modules/unified-args/LICENSE create mode 100644 node_modules/unified-args/index.js create mode 100644 node_modules/unified-args/lib/index.js create mode 100644 node_modules/unified-args/lib/options.js create mode 100644 node_modules/unified-args/lib/schema.json create mode 100644 node_modules/unified-args/package.json create mode 100644 node_modules/unified-args/readme.md create mode 100644 node_modules/unified-engine/LICENSE create mode 100644 node_modules/unified-engine/lib/configuration.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/configure.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/copy.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/file-system.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/index.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/parse.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/queue.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/read.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/stdout.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/stringify.js create mode 100644 node_modules/unified-engine/lib/file-pipeline/transform.js create mode 100644 node_modules/unified-engine/lib/file-set-pipeline/configure.js create mode 100644 node_modules/unified-engine/lib/file-set-pipeline/file-system.js create mode 100644 node_modules/unified-engine/lib/file-set-pipeline/index.js create mode 100644 node_modules/unified-engine/lib/file-set-pipeline/log.js create mode 100644 node_modules/unified-engine/lib/file-set-pipeline/stdin.js create mode 100644 node_modules/unified-engine/lib/file-set-pipeline/transform.js create mode 100644 node_modules/unified-engine/lib/file-set.js create mode 100644 node_modules/unified-engine/lib/find-up.js create mode 100644 node_modules/unified-engine/lib/finder.js create mode 100644 node_modules/unified-engine/lib/ignore.js create mode 100644 node_modules/unified-engine/lib/index.js create mode 100644 node_modules/unified-engine/node_modules/debug/CHANGELOG.md create mode 100644 node_modules/unified-engine/node_modules/debug/LICENSE create mode 100644 node_modules/unified-engine/node_modules/debug/README.md create mode 100644 node_modules/unified-engine/node_modules/debug/dist/debug.js create mode 100644 node_modules/unified-engine/node_modules/debug/node.js create mode 100644 node_modules/unified-engine/node_modules/debug/package.json create mode 100644 node_modules/unified-engine/node_modules/debug/src/browser.js create mode 100644 node_modules/unified-engine/node_modules/debug/src/common.js create mode 100644 node_modules/unified-engine/node_modules/debug/src/index.js create mode 100644 node_modules/unified-engine/node_modules/debug/src/node.js create mode 100644 node_modules/unified-engine/node_modules/ms/index.js create mode 100644 node_modules/unified-engine/node_modules/ms/license.md create mode 100644 node_modules/unified-engine/node_modules/ms/package.json create mode 100644 node_modules/unified-engine/node_modules/ms/readme.md create mode 100644 node_modules/unified-engine/package.json create mode 100644 node_modules/unified-engine/readme.md create mode 100644 node_modules/unified-lint-rule/index.js create mode 100644 node_modules/unified-lint-rule/package.json create mode 100644 node_modules/unified-lint-rule/readme.md create mode 100644 node_modules/unified-message-control/LICENSE create mode 100644 node_modules/unified-message-control/index.js create mode 100644 node_modules/unified-message-control/package.json create mode 100644 node_modules/unified-message-control/readme.md create mode 100644 node_modules/unified/LICENSE create mode 100644 node_modules/unified/index.js create mode 100644 node_modules/unified/package.json create mode 100644 node_modules/unified/readme.md 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/package.json create mode 100644 node_modules/unist-util-generated/index.js create mode 100644 node_modules/unist-util-generated/license create mode 100644 node_modules/unist-util-generated/package.json create mode 100644 node_modules/unist-util-generated/readme.md create mode 100644 node_modules/unist-util-inspect/index.js create mode 100644 node_modules/unist-util-inspect/license create mode 100644 node_modules/unist-util-inspect/package.json create mode 100644 node_modules/unist-util-inspect/readme.md create mode 100644 node_modules/unist-util-is/convert.js create mode 100644 node_modules/unist-util-is/index.js create mode 100644 node_modules/unist-util-is/license create mode 100644 node_modules/unist-util-is/package.json create mode 100644 node_modules/unist-util-is/readme.md create mode 100644 node_modules/unist-util-position/index.js create mode 100644 node_modules/unist-util-position/license create mode 100644 node_modules/unist-util-position/package.json create mode 100644 node_modules/unist-util-position/readme.md create mode 100644 node_modules/unist-util-remove-position/index.js create mode 100644 node_modules/unist-util-remove-position/license create mode 100644 node_modules/unist-util-remove-position/package.json create mode 100644 node_modules/unist-util-remove-position/readme.md create mode 100644 node_modules/unist-util-stringify-position/LICENSE create mode 100644 node_modules/unist-util-stringify-position/index.js create mode 100644 node_modules/unist-util-stringify-position/package.json create mode 100644 node_modules/unist-util-stringify-position/readme.md create mode 100644 node_modules/unist-util-visit-parents/index.js create mode 100644 node_modules/unist-util-visit-parents/license create mode 100644 node_modules/unist-util-visit-parents/package.json create mode 100644 node_modules/unist-util-visit-parents/readme.md create mode 100644 node_modules/unist-util-visit/index.js create mode 100644 node_modules/unist-util-visit/license create mode 100644 node_modules/unist-util-visit/package.json create mode 100644 node_modules/unist-util-visit/readme.md 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/node_modules/isobject/LICENSE create mode 100644 node_modules/unset-value/node_modules/isobject/README.md create mode 100644 node_modules/unset-value/node_modules/isobject/index.d.ts create mode 100644 node_modules/unset-value/node_modules/isobject/index.js create mode 100644 node_modules/unset-value/node_modules/isobject/package.json create mode 100644 node_modules/unset-value/package.json create mode 100644 node_modules/untildify/index.js create mode 100644 node_modules/untildify/license create mode 100644 node_modules/untildify/package.json create mode 100644 node_modules/untildify/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/use/LICENSE create mode 100644 node_modules/use/README.md create mode 100644 node_modules/use/index.js 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/vfile-location/index.js create mode 100644 node_modules/vfile-location/license create mode 100644 node_modules/vfile-location/package.json create mode 100644 node_modules/vfile-location/readme.md create mode 100644 node_modules/vfile-message/index.js create mode 100644 node_modules/vfile-message/license create mode 100644 node_modules/vfile-message/package.json create mode 100644 node_modules/vfile-message/readme.md create mode 100644 node_modules/vfile-reporter/LICENSE create mode 100644 node_modules/vfile-reporter/index.js create mode 100644 node_modules/vfile-reporter/node_modules/has-flag/index.js create mode 100644 node_modules/vfile-reporter/node_modules/has-flag/license create mode 100644 node_modules/vfile-reporter/node_modules/has-flag/package.json create mode 100644 node_modules/vfile-reporter/node_modules/has-flag/readme.md create mode 100644 node_modules/vfile-reporter/node_modules/supports-color/browser.js create mode 100644 node_modules/vfile-reporter/node_modules/supports-color/index.js create mode 100644 node_modules/vfile-reporter/node_modules/supports-color/license create mode 100644 node_modules/vfile-reporter/node_modules/supports-color/package.json create mode 100644 node_modules/vfile-reporter/node_modules/supports-color/readme.md create mode 100644 node_modules/vfile-reporter/package.json create mode 100644 node_modules/vfile-reporter/readme.md create mode 100644 node_modules/vfile-statistics/index.js create mode 100644 node_modules/vfile-statistics/license create mode 100644 node_modules/vfile-statistics/package.json create mode 100644 node_modules/vfile-statistics/readme.md create mode 100644 node_modules/vfile/LICENSE create mode 100644 node_modules/vfile/core.js create mode 100644 node_modules/vfile/index.js create mode 100644 node_modules/vfile/package.json create mode 100644 node_modules/vfile/readme.md create mode 100644 node_modules/wrapped/History.md create mode 100644 node_modules/wrapped/Readme.md create mode 100644 node_modules/wrapped/index.js create mode 100644 node_modules/wrapped/package.json create mode 100644 node_modules/wrappy/LICENSE create mode 100644 node_modules/wrappy/README.md create mode 100644 node_modules/wrappy/package.json create mode 100644 node_modules/wrappy/wrappy.js create mode 100644 node_modules/x-is-function/LICENSE create mode 100644 node_modules/x-is-function/README.md create mode 100644 node_modules/x-is-function/index.js create mode 100644 node_modules/x-is-function/package.json create mode 100644 node_modules/x-is-string/.npmignore create mode 100644 node_modules/x-is-string/.travis.yml create mode 100644 node_modules/x-is-string/LICENCE create mode 100644 node_modules/x-is-string/README.md create mode 100644 node_modules/x-is-string/index.js create mode 100644 node_modules/x-is-string/package.json create mode 100644 node_modules/x-is-string/test/index.js create mode 100644 node_modules/xtend/.jshintrc create mode 100644 node_modules/xtend/LICENSE create mode 100644 node_modules/xtend/README.md create mode 100644 node_modules/xtend/immutable.js create mode 100644 node_modules/xtend/mutable.js create mode 100644 node_modules/xtend/package.json create mode 100644 node_modules/xtend/test.js create mode 100644 package-lock.json diff --git a/README.md b/README.md index 1a21bbd2..5280ce92 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/cpp-lln-lab/CPP_BIDS/master?filepath=notebooks%2Fbasic_usage.ipynb) +**Cite it** + +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4007674.svg)](https://doi.org/10.5281/zenodo.4007674) + **Unit tests and coverage** [![](https://img.shields.io/badge/Octave-CI-blue?logo=Octave&logoColor=white)](https://github.com/cpp-lln-lab/CPP_BIDS/actions) diff --git a/node_modules/.bin/atob b/node_modules/.bin/atob new file mode 120000 index 00000000..a68344a3 --- /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/esparse b/node_modules/.bin/esparse new file mode 120000 index 00000000..7423b18b --- /dev/null +++ b/node_modules/.bin/esparse @@ -0,0 +1 @@ +../esprima/bin/esparse.js \ No newline at end of file diff --git a/node_modules/.bin/esvalidate b/node_modules/.bin/esvalidate new file mode 120000 index 00000000..16069eff --- /dev/null +++ b/node_modules/.bin/esvalidate @@ -0,0 +1 @@ +../esprima/bin/esvalidate.js \ No newline at end of file diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml new file mode 120000 index 00000000..9dbd010d --- /dev/null +++ b/node_modules/.bin/js-yaml @@ -0,0 +1 @@ +../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/.bin/json5 b/node_modules/.bin/json5 new file mode 120000 index 00000000..217f3798 --- /dev/null +++ b/node_modules/.bin/json5 @@ -0,0 +1 @@ +../json5/lib/cli.js \ No newline at end of file diff --git a/node_modules/.bin/rc b/node_modules/.bin/rc new file mode 120000 index 00000000..48b3cda7 --- /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/remark b/node_modules/.bin/remark new file mode 120000 index 00000000..0c2bb1df --- /dev/null +++ b/node_modules/.bin/remark @@ -0,0 +1 @@ +../remark-cli/cli.js \ No newline at end of file diff --git a/node_modules/@types/unist/LICENSE b/node_modules/@types/unist/LICENSE new file mode 100644 index 00000000..21071075 --- /dev/null +++ b/node_modules/@types/unist/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/unist/README.md b/node_modules/@types/unist/README.md new file mode 100644 index 00000000..8b6fcdfe --- /dev/null +++ b/node_modules/@types/unist/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/unist` + +# Summary +This package contains type definitions for non-npm package Unist ( https://github.com/syntax-tree/unist ). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist + +Additional Details + * Last updated: Thu, 14 Feb 2019 18:10:46 GMT + * Dependencies: none + * Global values: none + +# Credits +These definitions were written by bizen241 , Jun Lu , Hernan Rajchert , Titus Wormer , Junyoung Choi . diff --git a/node_modules/@types/unist/index.d.ts b/node_modules/@types/unist/index.d.ts new file mode 100644 index 00000000..e5e052db --- /dev/null +++ b/node_modules/@types/unist/index.d.ts @@ -0,0 +1,98 @@ +// Type definitions for non-npm package Unist 2.0 +// Project: https://github.com/syntax-tree/unist +// Definitions by: bizen241 +// Jun Lu +// Hernan Rajchert +// Titus Wormer +// Junyoung Choi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/** + * Syntactic units in unist syntax trees are called nodes. + */ +export interface Node { + /** + * The variant of a node. + */ + type: string; + + /** + * Information from the ecosystem. + */ + data?: Data; + + /** + * Location of a node in a source document. + * Must not be present if a node is generated. + */ + position?: Position; + + [key: string]: unknown; +} + +/** + * Information associated by the ecosystem with the node. + * Space is guaranteed to never be specified by unist or specifications + * implementing unist. + */ +export interface Data { + [key: string]: unknown; +} + +/** + * Location of a node in a source file. + */ +export interface Position { + /** + * Place of the first character of the parsed source region. + */ + start: Point; + + /** + * Place of the first character after the parsed source region. + */ + end: Point; + + /** + * Start column at each index (plus start line) in the source region, + * for elements that span multiple lines. + */ + indent?: number[]; +} + +/** + * One place in a source file. + */ +export interface Point { + /** + * Line in a source file (1-indexed integer). + */ + line: number; + + /** + * Column in a source file (1-indexed integer). + */ + column: number; + /** + * Character in a source file (0-indexed integer). + */ + offset?: number; +} + +/** + * Nodes containing other nodes. + */ +export interface Parent extends Node { + /** + * List representing the children of a node. + */ + children: Node[]; +} + +/** + * Nodes containing a value. + */ +export interface Literal extends Node { + value: unknown; +} diff --git a/node_modules/@types/unist/package.json b/node_modules/@types/unist/package.json new file mode 100644 index 00000000..de0dab21 --- /dev/null +++ b/node_modules/@types/unist/package.json @@ -0,0 +1,96 @@ +{ + "_from": "@types/unist@^2.0.0", + "_id": "@types/unist@2.0.3", + "_inBundle": false, + "_integrity": "sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ==", + "_location": "/@types/unist", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "@types/unist@^2.0.0", + "name": "@types/unist", + "escapedName": "@types%2funist", + "scope": "@types", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-blockquote-indentation/unist-util-visit", + "/remark-lint-blockquote-indentation/unist-util-visit-parents", + "/remark-lint-checkbox-character-style/unist-util-visit", + "/remark-lint-checkbox-character-style/unist-util-visit-parents", + "/remark-lint-code-block-style/unist-util-visit", + "/remark-lint-code-block-style/unist-util-visit-parents", + "/remark-lint-emphasis-marker/unist-util-visit", + "/remark-lint-emphasis-marker/unist-util-visit-parents", + "/remark-lint-fenced-code-marker/unist-util-visit", + "/remark-lint-fenced-code-marker/unist-util-visit-parents", + "/remark-lint-heading-style/unist-util-visit", + "/remark-lint-heading-style/unist-util-visit-parents", + "/remark-lint-link-title-style/unist-util-visit", + "/remark-lint-link-title-style/unist-util-visit-parents", + "/remark-lint-list-item-content-indent/unist-util-visit", + "/remark-lint-list-item-content-indent/unist-util-visit-parents", + "/remark-lint-no-duplicate-definitions/unist-util-stringify-position", + "/remark-lint-no-duplicate-headings/unist-util-stringify-position", + "/remark-lint-no-multiple-toplevel-headings/unist-util-stringify-position", + "/remark-lint-ordered-list-marker-style/unist-util-visit", + "/remark-lint-ordered-list-marker-style/unist-util-visit-parents", + "/remark-lint-rule-style/unist-util-visit", + "/remark-lint-rule-style/unist-util-visit-parents", + "/remark-lint-strong-marker/unist-util-visit", + "/remark-lint-strong-marker/unist-util-visit-parents", + "/remark-lint-table-cell-padding/unist-util-visit", + "/remark-lint-table-cell-padding/unist-util-visit-parents", + "/remark-preset-lint-consistent/unist-util-visit", + "/remark-preset-lint-consistent/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.3.tgz", + "_shasum": "9c088679876f374eb5983f150d4787aa6fb32d7e", + "_spec": "@types/unist@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "bizen241", + "url": "https://github.com/bizen241" + }, + { + "name": "Jun Lu", + "url": "https://github.com/lujun2" + }, + { + "name": "Hernan Rajchert", + "url": "https://github.com/hrajchert" + }, + { + "name": "Titus Wormer", + "url": "https://github.com/wooorm" + }, + { + "name": "Junyoung Choi", + "url": "https://github.com/rokt33r" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "TypeScript definitions for non-npm package Unist", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme", + "license": "MIT", + "main": "", + "name": "@types/unist", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "typeScriptVersion": "3.0", + "types": "index", + "typesPublisherContentHash": "555fe20f164ccded02a3f69d8b45c8c9d2ec6fd53844a7c7858a3001c281bc9b", + "version": "2.0.3" +} diff --git a/node_modules/ansi-regex/index.js b/node_modules/ansi-regex/index.js new file mode 100644 index 00000000..b9574ed7 --- /dev/null +++ b/node_modules/ansi-regex/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = function () { + return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; +}; diff --git a/node_modules/ansi-regex/license b/node_modules/ansi-regex/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/ansi-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/ansi-regex/package.json b/node_modules/ansi-regex/package.json new file mode 100644 index 00000000..0ac81a2a --- /dev/null +++ b/node_modules/ansi-regex/package.json @@ -0,0 +1,108 @@ +{ + "_from": "ansi-regex@^2.0.0", + "_id": "ansi-regex@2.1.1", + "_inBundle": false, + "_integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "_location": "/ansi-regex", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ansi-regex@^2.0.0", + "name": "ansi-regex", + "escapedName": "ansi-regex", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/strip-ansi" + ], + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df", + "_spec": "ansi-regex@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-regex/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Regular expression for matching ANSI escape codes", + "devDependencies": { + "ava": "0.17.0", + "xo": "0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/chalk/ansi-regex#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "license": "MIT", + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "jbnicolai.com" + }, + { + "name": "JD Ballard", + "email": "i.am.qix@gmail.com", + "url": "github.com/qix-" + } + ], + "name": "ansi-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-regex.git" + }, + "scripts": { + "test": "xo && ava --verbose", + "view-supported": "node fixtures/view-codes.js" + }, + "version": "2.1.1", + "xo": { + "rules": { + "guard-for-in": 0, + "no-loop-func": 0 + } + } +} diff --git a/node_modules/ansi-regex/readme.md b/node_modules/ansi-regex/readme.md new file mode 100644 index 00000000..6a928edf --- /dev/null +++ b/node_modules/ansi-regex/readme.md @@ -0,0 +1,39 @@ +# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install --save ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/ansi-styles/index.js b/node_modules/ansi-styles/index.js new file mode 100644 index 00000000..90a871c4 --- /dev/null +++ b/node_modules/ansi-styles/index.js @@ -0,0 +1,165 @@ +'use strict'; +const colorConvert = require('color-convert'); + +const wrapAnsi16 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => function () { + const rgb = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + + // Bright color + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Fix humans + styles.color.grey = styles.color.gray; + + for (const groupName of Object.keys(styles)) { + const group = styles[groupName]; + + for (const styleName of Object.keys(group)) { + const style = group[styleName]; + + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + } + + const ansi2ansi = n => n; + const rgb2rgb = (r, g, b) => [r, g, b]; + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = { + ansi: wrapAnsi16(ansi2ansi, 0) + }; + styles.color.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 0) + }; + styles.color.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 0) + }; + + styles.bgColor.ansi = { + ansi: wrapAnsi16(ansi2ansi, 10) + }; + styles.bgColor.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 10) + }; + styles.bgColor.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 10) + }; + + for (let key of Object.keys(colorConvert)) { + if (typeof colorConvert[key] !== 'object') { + continue; + } + + const suite = colorConvert[key]; + + if (key === 'ansi16') { + key = 'ansi'; + } + + if ('ansi16' in suite) { + styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); + styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); + } + + if ('ansi256' in suite) { + styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); + styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); + } + + if ('rgb' in suite) { + styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); + styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); + } + } + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); diff --git a/node_modules/ansi-styles/license b/node_modules/ansi-styles/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/ansi-styles/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/ansi-styles/package.json b/node_modules/ansi-styles/package.json new file mode 100644 index 00000000..9cb99822 --- /dev/null +++ b/node_modules/ansi-styles/package.json @@ -0,0 +1,88 @@ +{ + "_from": "ansi-styles@^3.2.1", + "_id": "ansi-styles@3.2.1", + "_inBundle": false, + "_integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "_location": "/ansi-styles", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ansi-styles@^3.2.1", + "name": "ansi-styles", + "escapedName": "ansi-styles", + "rawSpec": "^3.2.1", + "saveSpec": null, + "fetchSpec": "^3.2.1" + }, + "_requiredBy": [ + "/chalk" + ], + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "_shasum": "41fbb20243e50b12be0f04b8dedbf07520ce841d", + "_spec": "ansi-styles@^3.2.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/chalk", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "ava": { + "require": "babel-polyfill" + }, + "bugs": { + "url": "https://github.com/chalk/ansi-styles/issues" + }, + "bundleDependencies": false, + "dependencies": { + "color-convert": "^1.9.0" + }, + "deprecated": false, + "description": "ANSI escape codes for styling strings in the terminal", + "devDependencies": { + "ava": "*", + "babel-polyfill": "^6.23.0", + "svg-term-cli": "^2.1.1", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/chalk/ansi-styles#readme", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "name": "ansi-styles", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/ansi-styles.git" + }, + "scripts": { + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor", + "test": "xo && ava" + }, + "version": "3.2.1" +} diff --git a/node_modules/ansi-styles/readme.md b/node_modules/ansi-styles/readme.md new file mode 100644 index 00000000..3158e2df --- /dev/null +++ b/node_modules/ansi-styles/readme.md @@ -0,0 +1,147 @@ +# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) + +> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + + + + +## Install + +``` +$ npm install ansi-styles +``` + + +## Usage + +```js +const style = require('ansi-styles'); + +console.log(`${style.green.open}Hello world!${style.green.close}`); + + +// Color conversion between 16/256/truecolor +// NOTE: If conversion goes to 16 colors or 256 colors, the original color +// may be degraded to fit that color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); +console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close); +``` + +## API + +Each style has an `open` and `close` property. + + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `gray` ("bright black") +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + + +## Advanced usage + +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `style.modifier` +- `style.color` +- `style.bgColor` + +###### Example + +```js +console.log(style.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +console.log(style.codes.get(36)); +//=> 39 +``` + + +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) + +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. + +To use these, call the associated conversion function with the intended output, for example: + +```js +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code + +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code + +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code +``` + + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +## License + +MIT diff --git a/node_modules/anymatch/LICENSE b/node_modules/anymatch/LICENSE new file mode 100644 index 00000000..bc424705 --- /dev/null +++ b/node_modules/anymatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2014 Elan Shanker + +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/anymatch/README.md b/node_modules/anymatch/README.md new file mode 100644 index 00000000..62f65da8 --- /dev/null +++ b/node_modules/anymatch/README.md @@ -0,0 +1,98 @@ +anymatch [![Build Status](https://travis-ci.org/es128/anymatch.svg?branch=master)](https://travis-ci.org/es128/anymatch) [![Coverage Status](https://img.shields.io/coveralls/es128/anymatch.svg?branch=master)](https://coveralls.io/r/es128/anymatch?branch=master) +====== +Javascript module to match a string against a regular expression, glob, string, +or function that takes the string as an argument and returns a truthy or falsy +value. The matcher can also be an array of any or all of these. Useful for +allowing a very flexible user-defined config to define things like file paths. + +[![NPM](https://nodei.co/npm/anymatch.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/anymatch/) +[![NPM](https://nodei.co/npm-dl/anymatch.png?height=3&months=9)](https://nodei.co/npm-dl/anymatch/) + +Usage +----- +```sh +npm install anymatch --save +``` + +#### anymatch (matchers, testString, [returnIndex], [startIndex], [endIndex]) +* __matchers__: (_Array|String|RegExp|Function_) +String to be directly matched, string with glob patterns, regular expression +test, function that takes the testString as an argument and returns a truthy +value if it should be matched, or an array of any number and mix of these types. +* __testString__: (_String|Array_) The string to test against the matchers. If +passed as an array, the first element of the array will be used as the +`testString` for non-function matchers, while the entire array will be applied +as the arguments for function matchers. +* __returnIndex__: (_Boolean [optional]_) If true, return the array index of +the first matcher that that testString matched, or -1 if no match, instead of a +boolean result. +* __startIndex, endIndex__: (_Integer [optional]_) Can be used to define a +subset out of the array of provided matchers to test against. Can be useful +with bound matcher functions (see below). When used with `returnIndex = true` +preserves original indexing. Behaves the same as `Array.prototype.slice` (i.e. +includes array members up to, but not including endIndex). + +```js +var anymatch = require('anymatch'); + +var matchers = [ + 'path/to/file.js', + 'path/anyjs/**/*.js', + /foo\.js$/, + function (string) { + return string.indexOf('bar') !== -1 && string.length > 10 + } +]; + +anymatch(matchers, 'path/to/file.js'); // true +anymatch(matchers, 'path/anyjs/baz.js'); // true +anymatch(matchers, 'path/to/foo.js'); // true +anymatch(matchers, 'path/to/bar.js'); // true +anymatch(matchers, 'bar.js'); // false + +// returnIndex = true +anymatch(matchers, 'foo.js', true); // 2 +anymatch(matchers, 'path/anyjs/foo.js', true); // 1 + +// skip matchers +anymatch(matchers, 'path/to/file.js', false, 1); // false +anymatch(matchers, 'path/anyjs/foo.js', true, 2, 3); // 2 +anymatch(matchers, 'path/to/bar.js', true, 0, 3); // -1 + +// using globs to match directories and their children +anymatch('node_modules', 'node_modules'); // true +anymatch('node_modules', 'node_modules/somelib/index.js'); // false +anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true +anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false +anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true +``` + +#### anymatch (matchers) +You can also pass in only your matcher(s) to get a curried function that has +already been bound to the provided matching criteria. This can be used as an +`Array.prototype.filter` callback. + +```js +var matcher = anymatch(matchers); + +matcher('path/to/file.js'); // true +matcher('path/anyjs/baz.js', true); // 1 +matcher('path/anyjs/baz.js', true, 2); // -1 + +['foo.js', 'bar.js'].filter(matcher); // ['foo.js'] +``` + +Change Log +---------- +[See release notes page on GitHub](https://github.com/es128/anymatch/releases) + +NOTE: As of v1.2.0, anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch) +for glob pattern matching. The glob matching behavior should be functionally +equivalent to the commonly used [minimatch](https://github.com/isaacs/minimatch) +library (aside from some fixed bugs and greater performance), so a major +version bump wasn't merited. Issues with glob pattern matching should be +reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues). + +License +------- +[ISC](https://raw.github.com/es128/anymatch/master/LICENSE) diff --git a/node_modules/anymatch/index.js b/node_modules/anymatch/index.js new file mode 100644 index 00000000..e4116185 --- /dev/null +++ b/node_modules/anymatch/index.js @@ -0,0 +1,67 @@ +'use strict'; + +var micromatch = require('micromatch'); +var normalize = require('normalize-path'); +var path = require('path'); // required for tests. +var arrify = function(a) { return a == null ? [] : (Array.isArray(a) ? a : [a]); }; + +var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) { + criteria = arrify(criteria); + value = arrify(value); + if (arguments.length === 1) { + return anymatch.bind(null, criteria.map(function(criterion) { + return typeof criterion === 'string' && criterion[0] !== '!' ? + micromatch.matcher(criterion) : criterion; + })); + } + startIndex = startIndex || 0; + var string = value[0]; + var altString, altValue; + var matched = false; + var matchIndex = -1; + function testCriteria(criterion, index) { + var result; + switch (Object.prototype.toString.call(criterion)) { + case '[object String]': + result = string === criterion || altString && altString === criterion; + result = result || micromatch.isMatch(string, criterion); + break; + case '[object RegExp]': + result = criterion.test(string) || altString && criterion.test(altString); + break; + case '[object Function]': + result = criterion.apply(null, value); + result = result || altValue && criterion.apply(null, altValue); + break; + default: + result = false; + } + if (result) { + matchIndex = index + startIndex; + } + return result; + } + var crit = criteria; + var negGlobs = crit.reduce(function(arr, criterion, index) { + if (typeof criterion === 'string' && criterion[0] === '!') { + if (crit === criteria) { + // make a copy before modifying + crit = crit.slice(); + } + crit[index] = null; + arr.push(criterion.substr(1)); + } + return arr; + }, []); + if (!negGlobs.length || !micromatch.any(string, negGlobs)) { + if (path.sep === '\\' && typeof string === 'string') { + altString = normalize(string); + altString = altString === string ? null : altString; + if (altString) altValue = [altString].concat(value.slice(1)); + } + matched = crit.slice(startIndex, endIndex).some(testCriteria); + } + return returnIndex === true ? matchIndex : matched; +}; + +module.exports = anymatch; diff --git a/node_modules/anymatch/package.json b/node_modules/anymatch/package.json new file mode 100644 index 00000000..cc30a810 --- /dev/null +++ b/node_modules/anymatch/package.json @@ -0,0 +1,72 @@ +{ + "_from": "anymatch@^1.3.0", + "_id": "anymatch@1.3.2", + "_inBundle": false, + "_integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "_location": "/anymatch", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "anymatch@^1.3.0", + "name": "anymatch", + "escapedName": "anymatch", + "rawSpec": "^1.3.0", + "saveSpec": null, + "fetchSpec": "^1.3.0" + }, + "_requiredBy": [ + "/chokidar" + ], + "_resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "_shasum": "553dcb8f91e3c889845dfdba34c77721b90b9d7a", + "_spec": "anymatch@^1.3.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/chokidar", + "author": { + "name": "Elan Shanker", + "url": "http://github.com/es128" + }, + "bugs": { + "url": "https://github.com/es128/anymatch/issues" + }, + "bundleDependencies": false, + "dependencies": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + }, + "deprecated": false, + "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions", + "devDependencies": { + "coveralls": "^2.11.2", + "istanbul": "^0.3.13", + "mocha": "^2.2.4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/es128/anymatch", + "keywords": [ + "match", + "any", + "string", + "file", + "fs", + "list", + "glob", + "regex", + "regexp", + "regular", + "expression", + "function" + ], + "license": "ISC", + "name": "anymatch", + "repository": { + "type": "git", + "url": "git+https://github.com/es128/anymatch.git" + }, + "scripts": { + "test": "istanbul cover _mocha && cat ./coverage/lcov.info | coveralls" + }, + "version": "1.3.2" +} diff --git a/node_modules/argparse/CHANGELOG.md b/node_modules/argparse/CHANGELOG.md new file mode 100644 index 00000000..a43c628c --- /dev/null +++ b/node_modules/argparse/CHANGELOG.md @@ -0,0 +1,185 @@ +1.0.10 / 2018-02-15 +------------------ + +- Use .concat instead of + for arrays, #122. + + +1.0.9 / 2016-09-29 +------------------ + +- Rerelease after 1.0.8 - deps cleanup. + + +1.0.8 / 2016-09-29 +------------------ + +- Maintenance (deps bump, fix node 6.5+ tests, coverage report). + + +1.0.7 / 2016-03-17 +------------------ + +- Teach `addArgument` to accept string arg names. #97, @tomxtobin. + + +1.0.6 / 2016-02-06 +------------------ + +- Maintenance: moved to eslint & updated CS. + + +1.0.5 / 2016-02-05 +------------------ + +- Removed lodash dependency to significantly reduce install size. + Thanks to @mourner. + + +1.0.4 / 2016-01-17 +------------------ + +- Maintenance: lodash update to 4.0.0. + + +1.0.3 / 2015-10-27 +------------------ + +- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple. + + +1.0.2 / 2015-03-22 +------------------ + +- Relaxed lodash version dependency. + + +1.0.1 / 2015-02-20 +------------------ + +- Changed dependencies to be compatible with ancient nodejs. + + +1.0.0 / 2015-02-19 +------------------ + +- Maintenance release. +- Replaced `underscore` with `lodash`. +- Bumped version to 1.0.0 to better reflect semver meaning. +- HISTORY.md -> CHANGELOG.md + + +0.1.16 / 2013-12-01 +------------------- + +- Maintenance release. Updated dependencies and docs. + + +0.1.15 / 2013-05-13 +------------------- + +- Fixed #55, @trebor89 + + +0.1.14 / 2013-05-12 +------------------- + +- Fixed #62, @maxtaco + + +0.1.13 / 2013-04-08 +------------------- + +- Added `.npmignore` to reduce package size + + +0.1.12 / 2013-02-10 +------------------- + +- Fixed conflictHandler (#46), @hpaulj + + +0.1.11 / 2013-02-07 +------------------- + +- Multiple bugfixes, @hpaulj +- Added 70+ tests (ported from python), @hpaulj +- Added conflictHandler, @applepicke +- Added fromfilePrefixChar, @hpaulj + + +0.1.10 / 2012-12-30 +------------------- + +- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion) + support, thanks to @hpaulj +- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj + + +0.1.9 / 2012-12-27 +------------------ + +- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj +- Fixed default value behavior with `*` positionals, thanks to @hpaulj +- Improve `getDefault()` behavior, thanks to @hpaulj +- Imrove negative argument parsing, thanks to @hpaulj + + +0.1.8 / 2012-12-01 +------------------ + +- Fixed parser parents (issue #19), thanks to @hpaulj +- Fixed negative argument parse (issue #20), thanks to @hpaulj + + +0.1.7 / 2012-10-14 +------------------ + +- Fixed 'choices' argument parse (issue #16) +- Fixed stderr output (issue #15) + + +0.1.6 / 2012-09-09 +------------------ + +- Fixed check for conflict of options (thanks to @tomxtobin) + + +0.1.5 / 2012-09-03 +------------------ + +- Fix parser #setDefaults method (thanks to @tomxtobin) + + +0.1.4 / 2012-07-30 +------------------ + +- Fixed pseudo-argument support (thanks to @CGamesPlay) +- Fixed addHelp default (should be true), if not set (thanks to @benblank) + + +0.1.3 / 2012-06-27 +------------------ + +- Fixed formatter api name: Formatter -> HelpFormatter + + +0.1.2 / 2012-05-29 +------------------ + +- Added basic tests +- Removed excess whitespace in help +- Fixed error reporting, when parcer with subcommands + called with empty arguments + + +0.1.1 / 2012-05-23 +------------------ + +- Fixed line wrapping in help formatter +- Added better error reporting on invalid arguments + + +0.1.0 / 2012-05-16 +------------------ + +- First release. diff --git a/node_modules/argparse/LICENSE b/node_modules/argparse/LICENSE new file mode 100644 index 00000000..1afdae55 --- /dev/null +++ b/node_modules/argparse/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (C) 2012 by Vitaly Puzrin + +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/argparse/README.md b/node_modules/argparse/README.md new file mode 100644 index 00000000..7fa6c405 --- /dev/null +++ b/node_modules/argparse/README.md @@ -0,0 +1,257 @@ +argparse +======== + +[![Build Status](https://secure.travis-ci.org/nodeca/argparse.svg?branch=master)](http://travis-ci.org/nodeca/argparse) +[![NPM version](https://img.shields.io/npm/v/argparse.svg)](https://www.npmjs.org/package/argparse) + +CLI arguments parser for node.js. Javascript port of python's +[argparse](http://docs.python.org/dev/library/argparse.html) module +(original version 3.2). That's a full port, except some very rare options, +recorded in issue tracker. + +**NB. Difference with original.** + +- Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/). +- Use `defaultValue` instead of `default`. +- Use `argparse.Const.REMAINDER` instead of `argparse.REMAINDER`, and + similarly for constant values `OPTIONAL`, `ZERO_OR_MORE`, and `ONE_OR_MORE` + (aliases for `nargs` values `'?'`, `'*'`, `'+'`, respectively), and + `SUPPRESS`. + + +Example +======= + +test.js file: + +```javascript +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp:true, + description: 'Argparse example' +}); +parser.addArgument( + [ '-f', '--foo' ], + { + help: 'foo bar' + } +); +parser.addArgument( + [ '-b', '--bar' ], + { + help: 'bar foo' + } +); +parser.addArgument( + '--baz', + { + help: 'baz bar' + } +); +var args = parser.parseArgs(); +console.dir(args); +``` + +Display help: + +``` +$ ./test.js -h +usage: example.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ] + +Argparse example + +Optional arguments: + -h, --help Show this help message and exit. + -v, --version Show program's version number and exit. + -f FOO, --foo FOO foo bar + -b BAR, --bar BAR bar foo + --baz BAZ baz bar +``` + +Parse arguments: + +``` +$ ./test.js -f=3 --bar=4 --baz 5 +{ foo: '3', bar: '4', baz: '5' } +``` + +More [examples](https://github.com/nodeca/argparse/tree/master/examples). + + +ArgumentParser objects +====================== + +``` +new ArgumentParser({parameters hash}); +``` + +Creates a new ArgumentParser object. + +**Supported params:** + +- ```description``` - Text to display before the argument help. +- ```epilog``` - Text to display after the argument help. +- ```addHelp``` - Add a -h/–help option to the parser. (default: true) +- ```argumentDefault``` - Set the global default value for arguments. (default: null) +- ```parents``` - A list of ArgumentParser objects whose arguments should also be included. +- ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘) +- ```formatterClass``` - A class for customizing the help output. +- ```prog``` - The name of the program (default: `path.basename(process.argv[1])`) +- ```usage``` - The string describing the program usage (default: generated) +- ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals. + +**Not supported yet** + +- ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read. + + +Details in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects) + + +addArgument() method +==================== + +``` +ArgumentParser.addArgument(name or flag or [name] or [flags...], {options}) +``` + +Defines how a single command-line argument should be parsed. + +- ```name or flag or [name] or [flags...]``` - Either a positional name + (e.g., `'foo'`), a single option (e.g., `'-f'` or `'--foo'`), an array + of a single positional name (e.g., `['foo']`), or an array of options + (e.g., `['-f', '--foo']`). + +Options: + +- ```action``` - The basic type of action to be taken when this argument is encountered at the command line. +- ```nargs```- The number of command-line arguments that should be consumed. +- ```constant``` - A constant value required by some action and nargs selections. +- ```defaultValue``` - The value produced if the argument is absent from the command line. +- ```type``` - The type to which the command-line argument should be converted. +- ```choices``` - A container of the allowable values for the argument. +- ```required``` - Whether or not the command-line option may be omitted (optionals only). +- ```help``` - A brief description of what the argument does. +- ```metavar``` - A name for the argument in usage messages. +- ```dest``` - The name of the attribute to be added to the object returned by parseArgs(). + +Details in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method) + + +Action (some details) +================ + +ArgumentParser objects associate command-line arguments with actions. +These actions can do just about anything with the command-line arguments associated +with them, though most actions simply add an attribute to the object returned by +parseArgs(). The action keyword argument specifies how the command-line arguments +should be handled. The supported actions are: + +- ```store``` - Just stores the argument’s value. This is the default action. +- ```storeConst``` - Stores value, specified by the const keyword argument. + (Note that the const keyword argument defaults to the rather unhelpful None.) + The 'storeConst' action is most commonly used with optional arguments, that + specify some sort of flag. +- ```storeTrue``` and ```storeFalse``` - Stores values True and False + respectively. These are special cases of 'storeConst'. +- ```append``` - Stores a list, and appends each argument value to the list. + This is useful to allow an option to be specified multiple times. +- ```appendConst``` - Stores a list, and appends value, specified by the + const keyword argument to the list. (Note, that the const keyword argument defaults + is None.) The 'appendConst' action is typically used when multiple arguments need + to store constants to the same list. +- ```count``` - Counts the number of times a keyword argument occurs. For example, + used for increasing verbosity levels. +- ```help``` - Prints a complete help message for all the options in the current + parser and then exits. By default a help action is automatically added to the parser. + See ArgumentParser for details of how the output is created. +- ```version``` - Prints version information and exit. Expects a `version=` + keyword argument in the addArgument() call. + +Details in [original action guide](http://docs.python.org/dev/library/argparse.html#action) + + +Sub-commands +============ + +ArgumentParser.addSubparsers() + +Many programs split their functionality into a number of sub-commands, for +example, the svn program can invoke sub-commands like `svn checkout`, `svn update`, +and `svn commit`. Splitting up functionality this way can be a particularly good +idea when a program performs several different functions which require different +kinds of command-line arguments. `ArgumentParser` supports creation of such +sub-commands with `addSubparsers()` method. The `addSubparsers()` method is +normally called with no arguments and returns an special action object. +This object has a single method `addParser()`, which takes a command name and +any `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object +that can be modified as usual. + +Example: + +sub_commands.js +```javascript +#!/usr/bin/env node +'use strict'; + +var ArgumentParser = require('../lib/argparse').ArgumentParser; +var parser = new ArgumentParser({ + version: '0.0.1', + addHelp:true, + description: 'Argparse examples: sub-commands', +}); + +var subparsers = parser.addSubparsers({ + title:'subcommands', + dest:"subcommand_name" +}); + +var bar = subparsers.addParser('c1', {addHelp:true}); +bar.addArgument( + [ '-f', '--foo' ], + { + action: 'store', + help: 'foo3 bar3' + } +); +var bar = subparsers.addParser( + 'c2', + {aliases:['co'], addHelp:true} +); +bar.addArgument( + [ '-b', '--bar' ], + { + action: 'store', + type: 'int', + help: 'foo3 bar3' + } +); + +var args = parser.parseArgs(); +console.dir(args); + +``` + +Details in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands) + + +Contributors +============ + +- [Eugene Shkuropat](https://github.com/shkuropat) +- [Paul Jacobson](https://github.com/hpaulj) + +[others](https://github.com/nodeca/argparse/graphs/contributors) + +License +======= + +Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin). +Released under the MIT license. See +[LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details. + + diff --git a/node_modules/argparse/index.js b/node_modules/argparse/index.js new file mode 100644 index 00000000..3bbc1432 --- /dev/null +++ b/node_modules/argparse/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/argparse'); diff --git a/node_modules/argparse/lib/action.js b/node_modules/argparse/lib/action.js new file mode 100644 index 00000000..1483c79f --- /dev/null +++ b/node_modules/argparse/lib/action.js @@ -0,0 +1,146 @@ +/** + * class Action + * + * Base class for all actions + * Do not call in your code, use this class only for inherits your own action + * + * Information about how to convert command line strings to Javascript objects. + * Action objects are used by an ArgumentParser to represent the information + * needed to parse a single argument from one or more strings from the command + * line. The keyword arguments to the Action constructor are also all attributes + * of Action instances. + * + * ##### Allowed keywords: + * + * - `store` + * - `storeConstant` + * - `storeTrue` + * - `storeFalse` + * - `append` + * - `appendConstant` + * - `count` + * - `help` + * - `version` + * + * Information about action options see [[Action.new]] + * + * See also [original guide](http://docs.python.org/dev/library/argparse.html#action) + * + **/ + +'use strict'; + + +// Constants +var c = require('./const'); + + +/** + * new Action(options) + * + * Base class for all actions. Used only for inherits + * + * + * ##### Options: + * + * - `optionStrings` A list of command-line option strings for the action. + * - `dest` Attribute to hold the created object(s) + * - `nargs` The number of command-line arguments that should be consumed. + * By default, one argument will be consumed and a single value will be + * produced. + * - `constant` Default value for an action with no value. + * - `defaultValue` The value to be produced if the option is not specified. + * - `type` Cast to 'string'|'int'|'float'|'complex'|function (string). If + * None, 'string'. + * - `choices` The choices available. + * - `required` True if the action must always be specified at the command + * line. + * - `help` The help describing the argument. + * - `metavar` The name to be used for the option's argument with the help + * string. If None, the 'dest' value will be used as the name. + * + * ##### nargs supported values: + * + * - `N` (an integer) consumes N arguments (and produces a list) + * - `?` consumes zero or one arguments + * - `*` consumes zero or more arguments (and produces a list) + * - `+` consumes one or more arguments (and produces a list) + * + * Note: that the difference between the default and nargs=1 is that with the + * default, a single value will be produced, while with nargs=1, a list + * containing a single value will be produced. + **/ +var Action = module.exports = function Action(options) { + options = options || {}; + this.optionStrings = options.optionStrings || []; + this.dest = options.dest; + this.nargs = typeof options.nargs !== 'undefined' ? options.nargs : null; + this.constant = typeof options.constant !== 'undefined' ? options.constant : null; + this.defaultValue = options.defaultValue; + this.type = typeof options.type !== 'undefined' ? options.type : null; + this.choices = typeof options.choices !== 'undefined' ? options.choices : null; + this.required = typeof options.required !== 'undefined' ? options.required : false; + this.help = typeof options.help !== 'undefined' ? options.help : null; + this.metavar = typeof options.metavar !== 'undefined' ? options.metavar : null; + + if (!(this.optionStrings instanceof Array)) { + throw new Error('optionStrings should be an array'); + } + if (typeof this.required !== 'undefined' && typeof this.required !== 'boolean') { + throw new Error('required should be a boolean'); + } +}; + +/** + * Action#getName -> String + * + * Tells action name + **/ +Action.prototype.getName = function () { + if (this.optionStrings.length > 0) { + return this.optionStrings.join('/'); + } else if (this.metavar !== null && this.metavar !== c.SUPPRESS) { + return this.metavar; + } else if (typeof this.dest !== 'undefined' && this.dest !== c.SUPPRESS) { + return this.dest; + } + return null; +}; + +/** + * Action#isOptional -> Boolean + * + * Return true if optional + **/ +Action.prototype.isOptional = function () { + return !this.isPositional(); +}; + +/** + * Action#isPositional -> Boolean + * + * Return true if positional + **/ +Action.prototype.isPositional = function () { + return (this.optionStrings.length === 0); +}; + +/** + * Action#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Should be implemented in inherited classes + * + * ##### Example + * + * ActionCount.prototype.call = function (parser, namespace, values, optionString) { + * namespace.set(this.dest, (namespace[this.dest] || 0) + 1); + * }; + * + **/ +Action.prototype.call = function () { + throw new Error('.call() not defined');// Not Implemented error +}; diff --git a/node_modules/argparse/lib/action/append.js b/node_modules/argparse/lib/action/append.js new file mode 100644 index 00000000..b5da0de2 --- /dev/null +++ b/node_modules/argparse/lib/action/append.js @@ -0,0 +1,53 @@ +/*:nodoc:* + * class ActionAppend + * + * This action stores a list, and appends each argument value to the list. + * This is useful to allow an option to be specified multiple times. + * This class inherided from [[Action]] + * + **/ + +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var c = require('../const'); + +/*:nodoc:* + * new ActionAppend(options) + * - options (object): options hash see [[Action.new]] + * + * Note: options.nargs should be optional for constants + * and more then zero for other + **/ +var ActionAppend = module.exports = function ActionAppend(options) { + options = options || {}; + if (this.nargs <= 0) { + throw new Error('nargs for append actions must be > 0; if arg ' + + 'strings are not supplying the value to append, ' + + 'the append const action may be more appropriate'); + } + if (!!this.constant && this.nargs !== c.OPTIONAL) { + throw new Error('nargs must be OPTIONAL to supply const'); + } + Action.call(this, options); +}; +util.inherits(ActionAppend, Action); + +/*:nodoc:* + * ActionAppend#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionAppend.prototype.call = function (parser, namespace, values) { + var items = (namespace[this.dest] || []).slice(); + items.push(values); + namespace.set(this.dest, items); +}; diff --git a/node_modules/argparse/lib/action/append/constant.js b/node_modules/argparse/lib/action/append/constant.js new file mode 100644 index 00000000..313f5d2e --- /dev/null +++ b/node_modules/argparse/lib/action/append/constant.js @@ -0,0 +1,47 @@ +/*:nodoc:* + * class ActionAppendConstant + * + * This stores a list, and appends the value specified by + * the const keyword argument to the list. + * (Note that the const keyword argument defaults to null.) + * The 'appendConst' action is typically useful when multiple + * arguments need to store constants to the same list. + * + * This class inherited from [[Action]] + **/ + +'use strict'; + +var util = require('util'); + +var Action = require('../../action'); + +/*:nodoc:* + * new ActionAppendConstant(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionAppendConstant = module.exports = function ActionAppendConstant(options) { + options = options || {}; + options.nargs = 0; + if (typeof options.constant === 'undefined') { + throw new Error('constant option is required for appendAction'); + } + Action.call(this, options); +}; +util.inherits(ActionAppendConstant, Action); + +/*:nodoc:* + * ActionAppendConstant#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionAppendConstant.prototype.call = function (parser, namespace) { + var items = [].concat(namespace[this.dest] || []); + items.push(this.constant); + namespace.set(this.dest, items); +}; diff --git a/node_modules/argparse/lib/action/count.js b/node_modules/argparse/lib/action/count.js new file mode 100644 index 00000000..d6a5899d --- /dev/null +++ b/node_modules/argparse/lib/action/count.js @@ -0,0 +1,40 @@ +/*:nodoc:* + * class ActionCount + * + * This counts the number of times a keyword argument occurs. + * For example, this is useful for increasing verbosity levels + * + * This class inherided from [[Action]] + * + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +/*:nodoc:* + * new ActionCount(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionCount = module.exports = function ActionCount(options) { + options = options || {}; + options.nargs = 0; + + Action.call(this, options); +}; +util.inherits(ActionCount, Action); + +/*:nodoc:* + * ActionCount#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionCount.prototype.call = function (parser, namespace) { + namespace.set(this.dest, (namespace[this.dest] || 0) + 1); +}; diff --git a/node_modules/argparse/lib/action/help.js b/node_modules/argparse/lib/action/help.js new file mode 100644 index 00000000..b40e05a6 --- /dev/null +++ b/node_modules/argparse/lib/action/help.js @@ -0,0 +1,47 @@ +/*:nodoc:* + * class ActionHelp + * + * Support action for printing help + * This class inherided from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var c = require('../const'); + +/*:nodoc:* + * new ActionHelp(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionHelp = module.exports = function ActionHelp(options) { + options = options || {}; + if (options.defaultValue !== null) { + options.defaultValue = options.defaultValue; + } else { + options.defaultValue = c.SUPPRESS; + } + options.dest = (options.dest !== null ? options.dest : c.SUPPRESS); + options.nargs = 0; + Action.call(this, options); + +}; +util.inherits(ActionHelp, Action); + +/*:nodoc:* + * ActionHelp#call(parser, namespace, values, optionString) + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Print help and exit + **/ +ActionHelp.prototype.call = function (parser) { + parser.printHelp(); + parser.exit(); +}; diff --git a/node_modules/argparse/lib/action/store.js b/node_modules/argparse/lib/action/store.js new file mode 100644 index 00000000..283b8609 --- /dev/null +++ b/node_modules/argparse/lib/action/store.js @@ -0,0 +1,50 @@ +/*:nodoc:* + * class ActionStore + * + * This action just stores the argument’s value. This is the default action. + * + * This class inherited from [[Action]] + * + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// Constants +var c = require('../const'); + + +/*:nodoc:* + * new ActionStore(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStore = module.exports = function ActionStore(options) { + options = options || {}; + if (this.nargs <= 0) { + throw new Error('nargs for store actions must be > 0; if you ' + + 'have nothing to store, actions such as store ' + + 'true or store const may be more appropriate'); + + } + if (typeof this.constant !== 'undefined' && this.nargs !== c.OPTIONAL) { + throw new Error('nargs must be OPTIONAL to supply const'); + } + Action.call(this, options); +}; +util.inherits(ActionStore, Action); + +/*:nodoc:* + * ActionStore#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionStore.prototype.call = function (parser, namespace, values) { + namespace.set(this.dest, values); +}; diff --git a/node_modules/argparse/lib/action/store/constant.js b/node_modules/argparse/lib/action/store/constant.js new file mode 100644 index 00000000..23caa897 --- /dev/null +++ b/node_modules/argparse/lib/action/store/constant.js @@ -0,0 +1,43 @@ +/*:nodoc:* + * class ActionStoreConstant + * + * This action stores the value specified by the const keyword argument. + * (Note that the const keyword argument defaults to the rather unhelpful null.) + * The 'store_const' action is most commonly used with optional + * arguments that specify some sort of flag. + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../../action'); + +/*:nodoc:* + * new ActionStoreConstant(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStoreConstant = module.exports = function ActionStoreConstant(options) { + options = options || {}; + options.nargs = 0; + if (typeof options.constant === 'undefined') { + throw new Error('constant option is required for storeAction'); + } + Action.call(this, options); +}; +util.inherits(ActionStoreConstant, Action); + +/*:nodoc:* + * ActionStoreConstant#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Save result in namespace object + **/ +ActionStoreConstant.prototype.call = function (parser, namespace) { + namespace.set(this.dest, this.constant); +}; diff --git a/node_modules/argparse/lib/action/store/false.js b/node_modules/argparse/lib/action/store/false.js new file mode 100644 index 00000000..9924f461 --- /dev/null +++ b/node_modules/argparse/lib/action/store/false.js @@ -0,0 +1,27 @@ +/*:nodoc:* + * class ActionStoreFalse + * + * This action store the values False respectively. + * This is special cases of 'storeConst' + * + * This class inherited from [[Action]] + **/ + +'use strict'; + +var util = require('util'); + +var ActionStoreConstant = require('./constant'); + +/*:nodoc:* + * new ActionStoreFalse(options) + * - options (object): hash of options see [[Action.new]] + * + **/ +var ActionStoreFalse = module.exports = function ActionStoreFalse(options) { + options = options || {}; + options.constant = false; + options.defaultValue = options.defaultValue !== null ? options.defaultValue : true; + ActionStoreConstant.call(this, options); +}; +util.inherits(ActionStoreFalse, ActionStoreConstant); diff --git a/node_modules/argparse/lib/action/store/true.js b/node_modules/argparse/lib/action/store/true.js new file mode 100644 index 00000000..9e22f7d4 --- /dev/null +++ b/node_modules/argparse/lib/action/store/true.js @@ -0,0 +1,26 @@ +/*:nodoc:* + * class ActionStoreTrue + * + * This action store the values True respectively. + * This isspecial cases of 'storeConst' + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var ActionStoreConstant = require('./constant'); + +/*:nodoc:* + * new ActionStoreTrue(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionStoreTrue = module.exports = function ActionStoreTrue(options) { + options = options || {}; + options.constant = true; + options.defaultValue = options.defaultValue !== null ? options.defaultValue : false; + ActionStoreConstant.call(this, options); +}; +util.inherits(ActionStoreTrue, ActionStoreConstant); diff --git a/node_modules/argparse/lib/action/subparsers.js b/node_modules/argparse/lib/action/subparsers.js new file mode 100644 index 00000000..99dfedd0 --- /dev/null +++ b/node_modules/argparse/lib/action/subparsers.js @@ -0,0 +1,149 @@ +/** internal + * class ActionSubparsers + * + * Support the creation of such sub-commands with the addSubparsers() + * + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); +var format = require('util').format; + + +var Action = require('../action'); + +// Constants +var c = require('../const'); + +// Errors +var argumentErrorHelper = require('../argument/error'); + + +/*:nodoc:* + * new ChoicesPseudoAction(name, help) + * + * Create pseudo action for correct help text + * + **/ +function ChoicesPseudoAction(name, help) { + var options = { + optionStrings: [], + dest: name, + help: help + }; + + Action.call(this, options); +} + +util.inherits(ChoicesPseudoAction, Action); + +/** + * new ActionSubparsers(options) + * - options (object): options hash see [[Action.new]] + * + **/ +function ActionSubparsers(options) { + options = options || {}; + options.dest = options.dest || c.SUPPRESS; + options.nargs = c.PARSER; + + this.debug = (options.debug === true); + + this._progPrefix = options.prog; + this._parserClass = options.parserClass; + this._nameParserMap = {}; + this._choicesActions = []; + + options.choices = this._nameParserMap; + Action.call(this, options); +} + +util.inherits(ActionSubparsers, Action); + +/*:nodoc:* + * ActionSubparsers#addParser(name, options) -> ArgumentParser + * - name (string): sub-command name + * - options (object): see [[ArgumentParser.new]] + * + * Note: + * addParser supports an additional aliases option, + * which allows multiple strings to refer to the same subparser. + * This example, like svn, aliases co as a shorthand for checkout + * + **/ +ActionSubparsers.prototype.addParser = function (name, options) { + var parser; + + var self = this; + + options = options || {}; + + options.debug = (this.debug === true); + + // set program from the existing prefix + if (!options.prog) { + options.prog = this._progPrefix + ' ' + name; + } + + var aliases = options.aliases || []; + + // create a pseudo-action to hold the choice help + if (!!options.help || typeof options.help === 'string') { + var help = options.help; + delete options.help; + + var choiceAction = new ChoicesPseudoAction(name, help); + this._choicesActions.push(choiceAction); + } + + // create the parser and add it to the map + parser = new this._parserClass(options); + this._nameParserMap[name] = parser; + + // make parser available under aliases also + aliases.forEach(function (alias) { + self._nameParserMap[alias] = parser; + }); + + return parser; +}; + +ActionSubparsers.prototype._getSubactions = function () { + return this._choicesActions; +}; + +/*:nodoc:* + * ActionSubparsers#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Call the action. Parse input aguments + **/ +ActionSubparsers.prototype.call = function (parser, namespace, values) { + var parserName = values[0]; + var argStrings = values.slice(1); + + // set the parser name if requested + if (this.dest !== c.SUPPRESS) { + namespace[this.dest] = parserName; + } + + // select the parser + if (this._nameParserMap[parserName]) { + parser = this._nameParserMap[parserName]; + } else { + throw argumentErrorHelper(format( + 'Unknown parser "%s" (choices: [%s]).', + parserName, + Object.keys(this._nameParserMap).join(', ') + )); + } + + // parse all the remaining options into the namespace + parser.parseArgs(argStrings, namespace); +}; + +module.exports = ActionSubparsers; diff --git a/node_modules/argparse/lib/action/version.js b/node_modules/argparse/lib/action/version.js new file mode 100644 index 00000000..8053328c --- /dev/null +++ b/node_modules/argparse/lib/action/version.js @@ -0,0 +1,47 @@ +/*:nodoc:* + * class ActionVersion + * + * Support action for printing program version + * This class inherited from [[Action]] + **/ +'use strict'; + +var util = require('util'); + +var Action = require('../action'); + +// +// Constants +// +var c = require('../const'); + +/*:nodoc:* + * new ActionVersion(options) + * - options (object): options hash see [[Action.new]] + * + **/ +var ActionVersion = module.exports = function ActionVersion(options) { + options = options || {}; + options.defaultValue = (options.defaultValue ? options.defaultValue : c.SUPPRESS); + options.dest = (options.dest || c.SUPPRESS); + options.nargs = 0; + this.version = options.version; + Action.call(this, options); +}; +util.inherits(ActionVersion, Action); + +/*:nodoc:* + * ActionVersion#call(parser, namespace, values, optionString) -> Void + * - parser (ArgumentParser): current parser + * - namespace (Namespace): namespace for output data + * - values (Array): parsed values + * - optionString (Array): input option string(not parsed) + * + * Print version and exit + **/ +ActionVersion.prototype.call = function (parser) { + var version = this.version || parser.version; + var formatter = parser._getFormatter(); + formatter.addText(version); + parser.exit(0, formatter.formatHelp()); +}; diff --git a/node_modules/argparse/lib/action_container.js b/node_modules/argparse/lib/action_container.js new file mode 100644 index 00000000..6f1237be --- /dev/null +++ b/node_modules/argparse/lib/action_container.js @@ -0,0 +1,482 @@ +/** internal + * class ActionContainer + * + * Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]] + **/ + +'use strict'; + +var format = require('util').format; + +// Constants +var c = require('./const'); + +var $$ = require('./utils'); + +//Actions +var ActionHelp = require('./action/help'); +var ActionAppend = require('./action/append'); +var ActionAppendConstant = require('./action/append/constant'); +var ActionCount = require('./action/count'); +var ActionStore = require('./action/store'); +var ActionStoreConstant = require('./action/store/constant'); +var ActionStoreTrue = require('./action/store/true'); +var ActionStoreFalse = require('./action/store/false'); +var ActionVersion = require('./action/version'); +var ActionSubparsers = require('./action/subparsers'); + +// Errors +var argumentErrorHelper = require('./argument/error'); + +/** + * new ActionContainer(options) + * + * Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]] + * + * ##### Options: + * + * - `description` -- A description of what the program does + * - `prefixChars` -- Characters that prefix optional arguments + * - `argumentDefault` -- The default value for all arguments + * - `conflictHandler` -- The conflict handler to use for duplicate arguments + **/ +var ActionContainer = module.exports = function ActionContainer(options) { + options = options || {}; + + this.description = options.description; + this.argumentDefault = options.argumentDefault; + this.prefixChars = options.prefixChars || ''; + this.conflictHandler = options.conflictHandler; + + // set up registries + this._registries = {}; + + // register actions + this.register('action', null, ActionStore); + this.register('action', 'store', ActionStore); + this.register('action', 'storeConst', ActionStoreConstant); + this.register('action', 'storeTrue', ActionStoreTrue); + this.register('action', 'storeFalse', ActionStoreFalse); + this.register('action', 'append', ActionAppend); + this.register('action', 'appendConst', ActionAppendConstant); + this.register('action', 'count', ActionCount); + this.register('action', 'help', ActionHelp); + this.register('action', 'version', ActionVersion); + this.register('action', 'parsers', ActionSubparsers); + + // raise an exception if the conflict handler is invalid + this._getHandler(); + + // action storage + this._actions = []; + this._optionStringActions = {}; + + // groups + this._actionGroups = []; + this._mutuallyExclusiveGroups = []; + + // defaults storage + this._defaults = {}; + + // determines whether an "option" looks like a negative number + // -1, -1.5 -5e+4 + this._regexpNegativeNumber = new RegExp('^[-]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$'); + + // whether or not there are any optionals that look like negative + // numbers -- uses a list so it can be shared and edited + this._hasNegativeNumberOptionals = []; +}; + +// Groups must be required, then ActionContainer already defined +var ArgumentGroup = require('./argument/group'); +var MutuallyExclusiveGroup = require('./argument/exclusive'); + +// +// Registration methods +// + +/** + * ActionContainer#register(registryName, value, object) -> Void + * - registryName (String) : object type action|type + * - value (string) : keyword + * - object (Object|Function) : handler + * + * Register handlers + **/ +ActionContainer.prototype.register = function (registryName, value, object) { + this._registries[registryName] = this._registries[registryName] || {}; + this._registries[registryName][value] = object; +}; + +ActionContainer.prototype._registryGet = function (registryName, value, defaultValue) { + if (arguments.length < 3) { + defaultValue = null; + } + return this._registries[registryName][value] || defaultValue; +}; + +// +// Namespace default accessor methods +// + +/** + * ActionContainer#setDefaults(options) -> Void + * - options (object):hash of options see [[Action.new]] + * + * Set defaults + **/ +ActionContainer.prototype.setDefaults = function (options) { + options = options || {}; + for (var property in options) { + if ($$.has(options, property)) { + this._defaults[property] = options[property]; + } + } + + // if these defaults match any existing arguments, replace the previous + // default on the object with the new one + this._actions.forEach(function (action) { + if ($$.has(options, action.dest)) { + action.defaultValue = options[action.dest]; + } + }); +}; + +/** + * ActionContainer#getDefault(dest) -> Mixed + * - dest (string): action destination + * + * Return action default value + **/ +ActionContainer.prototype.getDefault = function (dest) { + var result = $$.has(this._defaults, dest) ? this._defaults[dest] : null; + + this._actions.forEach(function (action) { + if (action.dest === dest && $$.has(action, 'defaultValue')) { + result = action.defaultValue; + } + }); + + return result; +}; +// +// Adding argument actions +// + +/** + * ActionContainer#addArgument(args, options) -> Object + * - args (String|Array): argument key, or array of argument keys + * - options (Object): action objects see [[Action.new]] + * + * #### Examples + * - addArgument([ '-f', '--foo' ], { action: 'store', defaultValue: 1, ... }) + * - addArgument([ 'bar' ], { action: 'store', nargs: 1, ... }) + * - addArgument('--baz', { action: 'store', nargs: 1, ... }) + **/ +ActionContainer.prototype.addArgument = function (args, options) { + args = args; + options = options || {}; + + if (typeof args === 'string') { + args = [ args ]; + } + if (!Array.isArray(args)) { + throw new TypeError('addArgument first argument should be a string or an array'); + } + if (typeof options !== 'object' || Array.isArray(options)) { + throw new TypeError('addArgument second argument should be a hash'); + } + + // if no positional args are supplied or only one is supplied and + // it doesn't look like an option string, parse a positional argument + if (!args || args.length === 1 && this.prefixChars.indexOf(args[0][0]) < 0) { + if (args && !!options.dest) { + throw new Error('dest supplied twice for positional argument'); + } + options = this._getPositional(args, options); + + // otherwise, we're adding an optional argument + } else { + options = this._getOptional(args, options); + } + + // if no default was supplied, use the parser-level default + if (typeof options.defaultValue === 'undefined') { + var dest = options.dest; + if ($$.has(this._defaults, dest)) { + options.defaultValue = this._defaults[dest]; + } else if (typeof this.argumentDefault !== 'undefined') { + options.defaultValue = this.argumentDefault; + } + } + + // create the action object, and add it to the parser + var ActionClass = this._popActionClass(options); + if (typeof ActionClass !== 'function') { + throw new Error(format('Unknown action "%s".', ActionClass)); + } + var action = new ActionClass(options); + + // throw an error if the action type is not callable + var typeFunction = this._registryGet('type', action.type, action.type); + if (typeof typeFunction !== 'function') { + throw new Error(format('"%s" is not callable', typeFunction)); + } + + return this._addAction(action); +}; + +/** + * ActionContainer#addArgumentGroup(options) -> ArgumentGroup + * - options (Object): hash of options see [[ArgumentGroup.new]] + * + * Create new arguments groups + **/ +ActionContainer.prototype.addArgumentGroup = function (options) { + var group = new ArgumentGroup(this, options); + this._actionGroups.push(group); + return group; +}; + +/** + * ActionContainer#addMutuallyExclusiveGroup(options) -> ArgumentGroup + * - options (Object): {required: false} + * + * Create new mutual exclusive groups + **/ +ActionContainer.prototype.addMutuallyExclusiveGroup = function (options) { + var group = new MutuallyExclusiveGroup(this, options); + this._mutuallyExclusiveGroups.push(group); + return group; +}; + +ActionContainer.prototype._addAction = function (action) { + var self = this; + + // resolve any conflicts + this._checkConflict(action); + + // add to actions list + this._actions.push(action); + action.container = this; + + // index the action by any option strings it has + action.optionStrings.forEach(function (optionString) { + self._optionStringActions[optionString] = action; + }); + + // set the flag if any option strings look like negative numbers + action.optionStrings.forEach(function (optionString) { + if (optionString.match(self._regexpNegativeNumber)) { + if (!self._hasNegativeNumberOptionals.some(Boolean)) { + self._hasNegativeNumberOptionals.push(true); + } + } + }); + + // return the created action + return action; +}; + +ActionContainer.prototype._removeAction = function (action) { + var actionIndex = this._actions.indexOf(action); + if (actionIndex >= 0) { + this._actions.splice(actionIndex, 1); + } +}; + +ActionContainer.prototype._addContainerActions = function (container) { + // collect groups by titles + var titleGroupMap = {}; + this._actionGroups.forEach(function (group) { + if (titleGroupMap[group.title]) { + throw new Error(format('Cannot merge actions - two groups are named "%s".', group.title)); + } + titleGroupMap[group.title] = group; + }); + + // map each action to its group + var groupMap = {}; + function actionHash(action) { + // unique (hopefully?) string suitable as dictionary key + return action.getName(); + } + container._actionGroups.forEach(function (group) { + // if a group with the title exists, use that, otherwise + // create a new group matching the container's group + if (!titleGroupMap[group.title]) { + titleGroupMap[group.title] = this.addArgumentGroup({ + title: group.title, + description: group.description + }); + } + + // map the actions to their new group + group._groupActions.forEach(function (action) { + groupMap[actionHash(action)] = titleGroupMap[group.title]; + }); + }, this); + + // add container's mutually exclusive groups + // NOTE: if add_mutually_exclusive_group ever gains title= and + // description= then this code will need to be expanded as above + var mutexGroup; + container._mutuallyExclusiveGroups.forEach(function (group) { + mutexGroup = this.addMutuallyExclusiveGroup({ + required: group.required + }); + // map the actions to their new mutex group + group._groupActions.forEach(function (action) { + groupMap[actionHash(action)] = mutexGroup; + }); + }, this); // forEach takes a 'this' argument + + // add all actions to this container or their group + container._actions.forEach(function (action) { + var key = actionHash(action); + if (groupMap[key]) { + groupMap[key]._addAction(action); + } else { + this._addAction(action); + } + }); +}; + +ActionContainer.prototype._getPositional = function (dest, options) { + if (Array.isArray(dest)) { + dest = dest[0]; + } + // make sure required is not specified + if (options.required) { + throw new Error('"required" is an invalid argument for positionals.'); + } + + // mark positional arguments as required if at least one is + // always required + if (options.nargs !== c.OPTIONAL && options.nargs !== c.ZERO_OR_MORE) { + options.required = true; + } + if (options.nargs === c.ZERO_OR_MORE && typeof options.defaultValue === 'undefined') { + options.required = true; + } + + // return the keyword arguments with no option strings + options.dest = dest; + options.optionStrings = []; + return options; +}; + +ActionContainer.prototype._getOptional = function (args, options) { + var prefixChars = this.prefixChars; + var optionStrings = []; + var optionStringsLong = []; + + // determine short and long option strings + args.forEach(function (optionString) { + // error on strings that don't start with an appropriate prefix + if (prefixChars.indexOf(optionString[0]) < 0) { + throw new Error(format('Invalid option string "%s": must start with a "%s".', + optionString, + prefixChars + )); + } + + // strings starting with two prefix characters are long options + optionStrings.push(optionString); + if (optionString.length > 1 && prefixChars.indexOf(optionString[1]) >= 0) { + optionStringsLong.push(optionString); + } + }); + + // infer dest, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' + var dest = options.dest || null; + delete options.dest; + + if (!dest) { + var optionStringDest = optionStringsLong.length ? optionStringsLong[0] : optionStrings[0]; + dest = $$.trimChars(optionStringDest, this.prefixChars); + + if (dest.length === 0) { + throw new Error( + format('dest= is required for options like "%s"', optionStrings.join(', ')) + ); + } + dest = dest.replace(/-/g, '_'); + } + + // return the updated keyword arguments + options.dest = dest; + options.optionStrings = optionStrings; + + return options; +}; + +ActionContainer.prototype._popActionClass = function (options, defaultValue) { + defaultValue = defaultValue || null; + + var action = (options.action || defaultValue); + delete options.action; + + var actionClass = this._registryGet('action', action, action); + return actionClass; +}; + +ActionContainer.prototype._getHandler = function () { + var handlerString = this.conflictHandler; + var handlerFuncName = '_handleConflict' + $$.capitalize(handlerString); + var func = this[handlerFuncName]; + if (typeof func === 'undefined') { + var msg = 'invalid conflict resolution value: ' + handlerString; + throw new Error(msg); + } else { + return func; + } +}; + +ActionContainer.prototype._checkConflict = function (action) { + var optionStringActions = this._optionStringActions; + var conflictOptionals = []; + + // find all options that conflict with this option + // collect pairs, the string, and an existing action that it conflicts with + action.optionStrings.forEach(function (optionString) { + var conflOptional = optionStringActions[optionString]; + if (typeof conflOptional !== 'undefined') { + conflictOptionals.push([ optionString, conflOptional ]); + } + }); + + if (conflictOptionals.length > 0) { + var conflictHandler = this._getHandler(); + conflictHandler.call(this, action, conflictOptionals); + } +}; + +ActionContainer.prototype._handleConflictError = function (action, conflOptionals) { + var conflicts = conflOptionals.map(function (pair) { return pair[0]; }); + conflicts = conflicts.join(', '); + throw argumentErrorHelper( + action, + format('Conflicting option string(s): %s', conflicts) + ); +}; + +ActionContainer.prototype._handleConflictResolve = function (action, conflOptionals) { + // remove all conflicting options + var self = this; + conflOptionals.forEach(function (pair) { + var optionString = pair[0]; + var conflictingAction = pair[1]; + // remove the conflicting option string + var i = conflictingAction.optionStrings.indexOf(optionString); + if (i >= 0) { + conflictingAction.optionStrings.splice(i, 1); + } + delete self._optionStringActions[optionString]; + // if the option now has no option string, remove it from the + // container holding it + if (conflictingAction.optionStrings.length === 0) { + conflictingAction.container._removeAction(conflictingAction); + } + }); +}; diff --git a/node_modules/argparse/lib/argparse.js b/node_modules/argparse/lib/argparse.js new file mode 100644 index 00000000..f2a2c51d --- /dev/null +++ b/node_modules/argparse/lib/argparse.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports.ArgumentParser = require('./argument_parser.js'); +module.exports.Namespace = require('./namespace'); +module.exports.Action = require('./action'); +module.exports.HelpFormatter = require('./help/formatter.js'); +module.exports.Const = require('./const.js'); + +module.exports.ArgumentDefaultsHelpFormatter = + require('./help/added_formatters.js').ArgumentDefaultsHelpFormatter; +module.exports.RawDescriptionHelpFormatter = + require('./help/added_formatters.js').RawDescriptionHelpFormatter; +module.exports.RawTextHelpFormatter = + require('./help/added_formatters.js').RawTextHelpFormatter; diff --git a/node_modules/argparse/lib/argument/error.js b/node_modules/argparse/lib/argument/error.js new file mode 100644 index 00000000..c8a02a08 --- /dev/null +++ b/node_modules/argparse/lib/argument/error.js @@ -0,0 +1,50 @@ +'use strict'; + + +var format = require('util').format; + + +var ERR_CODE = 'ARGError'; + +/*:nodoc:* + * argumentError(argument, message) -> TypeError + * - argument (Object): action with broken argument + * - message (String): error message + * + * Error format helper. An error from creating or using an argument + * (optional or positional). The string value of this exception + * is the message, augmented with information + * about the argument that caused it. + * + * #####Example + * + * var argumentErrorHelper = require('./argument/error'); + * if (conflictOptionals.length > 0) { + * throw argumentErrorHelper( + * action, + * format('Conflicting option string(s): %s', conflictOptionals.join(', ')) + * ); + * } + * + **/ +module.exports = function (argument, message) { + var argumentName = null; + var errMessage; + var err; + + if (argument.getName) { + argumentName = argument.getName(); + } else { + argumentName = '' + argument; + } + + if (!argumentName) { + errMessage = message; + } else { + errMessage = format('argument "%s": %s', argumentName, message); + } + + err = new TypeError(errMessage); + err.code = ERR_CODE; + return err; +}; diff --git a/node_modules/argparse/lib/argument/exclusive.js b/node_modules/argparse/lib/argument/exclusive.js new file mode 100644 index 00000000..8287e00d --- /dev/null +++ b/node_modules/argparse/lib/argument/exclusive.js @@ -0,0 +1,54 @@ +/** internal + * class MutuallyExclusiveGroup + * + * Group arguments. + * By default, ArgumentParser groups command-line arguments + * into “positional arguments” and “optional arguments” + * when displaying help messages. When there is a better + * conceptual grouping of arguments than this default one, + * appropriate groups can be created using the addArgumentGroup() method + * + * This class inherited from [[ArgumentContainer]] + **/ +'use strict'; + +var util = require('util'); + +var ArgumentGroup = require('./group'); + +/** + * new MutuallyExclusiveGroup(container, options) + * - container (object): main container + * - options (object): options.required -> true/false + * + * `required` could be an argument itself, but making it a property of + * the options argument is more consistent with the JS adaptation of the Python) + **/ +var MutuallyExclusiveGroup = module.exports = function MutuallyExclusiveGroup(container, options) { + var required; + options = options || {}; + required = options.required || false; + ArgumentGroup.call(this, container); + this.required = required; + +}; +util.inherits(MutuallyExclusiveGroup, ArgumentGroup); + + +MutuallyExclusiveGroup.prototype._addAction = function (action) { + var msg; + if (action.required) { + msg = 'mutually exclusive arguments must be optional'; + throw new Error(msg); + } + action = this._container._addAction(action); + this._groupActions.push(action); + return action; +}; + + +MutuallyExclusiveGroup.prototype._removeAction = function (action) { + this._container._removeAction(action); + this._groupActions.remove(action); +}; + diff --git a/node_modules/argparse/lib/argument/group.js b/node_modules/argparse/lib/argument/group.js new file mode 100644 index 00000000..58b271f2 --- /dev/null +++ b/node_modules/argparse/lib/argument/group.js @@ -0,0 +1,75 @@ +/** internal + * class ArgumentGroup + * + * Group arguments. + * By default, ArgumentParser groups command-line arguments + * into “positional arguments” and “optional arguments” + * when displaying help messages. When there is a better + * conceptual grouping of arguments than this default one, + * appropriate groups can be created using the addArgumentGroup() method + * + * This class inherited from [[ArgumentContainer]] + **/ +'use strict'; + +var util = require('util'); + +var ActionContainer = require('../action_container'); + + +/** + * new ArgumentGroup(container, options) + * - container (object): main container + * - options (object): hash of group options + * + * #### options + * - **prefixChars** group name prefix + * - **argumentDefault** default argument value + * - **title** group title + * - **description** group description + * + **/ +var ArgumentGroup = module.exports = function ArgumentGroup(container, options) { + + options = options || {}; + + // add any missing keyword arguments by checking the container + options.conflictHandler = (options.conflictHandler || container.conflictHandler); + options.prefixChars = (options.prefixChars || container.prefixChars); + options.argumentDefault = (options.argumentDefault || container.argumentDefault); + + ActionContainer.call(this, options); + + // group attributes + this.title = options.title; + this._groupActions = []; + + // share most attributes with the container + this._container = container; + this._registries = container._registries; + this._actions = container._actions; + this._optionStringActions = container._optionStringActions; + this._defaults = container._defaults; + this._hasNegativeNumberOptionals = container._hasNegativeNumberOptionals; + this._mutuallyExclusiveGroups = container._mutuallyExclusiveGroups; +}; +util.inherits(ArgumentGroup, ActionContainer); + + +ArgumentGroup.prototype._addAction = function (action) { + // Parent add action + action = ActionContainer.prototype._addAction.call(this, action); + this._groupActions.push(action); + return action; +}; + + +ArgumentGroup.prototype._removeAction = function (action) { + // Parent remove action + ActionContainer.prototype._removeAction.call(this, action); + var actionIndex = this._groupActions.indexOf(action); + if (actionIndex >= 0) { + this._groupActions.splice(actionIndex, 1); + } +}; + diff --git a/node_modules/argparse/lib/argument_parser.js b/node_modules/argparse/lib/argument_parser.js new file mode 100644 index 00000000..bd9a59a4 --- /dev/null +++ b/node_modules/argparse/lib/argument_parser.js @@ -0,0 +1,1161 @@ +/** + * class ArgumentParser + * + * Object for parsing command line strings into js objects. + * + * Inherited from [[ActionContainer]] + **/ +'use strict'; + +var util = require('util'); +var format = require('util').format; +var Path = require('path'); +var sprintf = require('sprintf-js').sprintf; + +// Constants +var c = require('./const'); + +var $$ = require('./utils'); + +var ActionContainer = require('./action_container'); + +// Errors +var argumentErrorHelper = require('./argument/error'); + +var HelpFormatter = require('./help/formatter'); + +var Namespace = require('./namespace'); + + +/** + * new ArgumentParser(options) + * + * Create a new ArgumentParser object. + * + * ##### Options: + * - `prog` The name of the program (default: Path.basename(process.argv[1])) + * - `usage` A usage message (default: auto-generated from arguments) + * - `description` A description of what the program does + * - `epilog` Text following the argument descriptions + * - `parents` Parsers whose arguments should be copied into this one + * - `formatterClass` HelpFormatter class for printing help messages + * - `prefixChars` Characters that prefix optional arguments + * - `fromfilePrefixChars` Characters that prefix files containing additional arguments + * - `argumentDefault` The default value for all arguments + * - `addHelp` Add a -h/-help option + * - `conflictHandler` Specifies how to handle conflicting argument names + * - `debug` Enable debug mode. Argument errors throw exception in + * debug mode and process.exit in normal. Used for development and + * testing (default: false) + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#argumentparser-objects + **/ +function ArgumentParser(options) { + if (!(this instanceof ArgumentParser)) { + return new ArgumentParser(options); + } + var self = this; + options = options || {}; + + options.description = (options.description || null); + options.argumentDefault = (options.argumentDefault || null); + options.prefixChars = (options.prefixChars || '-'); + options.conflictHandler = (options.conflictHandler || 'error'); + ActionContainer.call(this, options); + + options.addHelp = typeof options.addHelp === 'undefined' || !!options.addHelp; + options.parents = options.parents || []; + // default program name + options.prog = (options.prog || Path.basename(process.argv[1])); + this.prog = options.prog; + this.usage = options.usage; + this.epilog = options.epilog; + this.version = options.version; + + this.debug = (options.debug === true); + + this.formatterClass = (options.formatterClass || HelpFormatter); + this.fromfilePrefixChars = options.fromfilePrefixChars || null; + this._positionals = this.addArgumentGroup({ title: 'Positional arguments' }); + this._optionals = this.addArgumentGroup({ title: 'Optional arguments' }); + this._subparsers = null; + + // register types + function FUNCTION_IDENTITY(o) { + return o; + } + this.register('type', 'auto', FUNCTION_IDENTITY); + this.register('type', null, FUNCTION_IDENTITY); + this.register('type', 'int', function (x) { + var result = parseInt(x, 10); + if (isNaN(result)) { + throw new Error(x + ' is not a valid integer.'); + } + return result; + }); + this.register('type', 'float', function (x) { + var result = parseFloat(x); + if (isNaN(result)) { + throw new Error(x + ' is not a valid float.'); + } + return result; + }); + this.register('type', 'string', function (x) { + return '' + x; + }); + + // add help and version arguments if necessary + var defaultPrefix = (this.prefixChars.indexOf('-') > -1) ? '-' : this.prefixChars[0]; + if (options.addHelp) { + this.addArgument( + [ defaultPrefix + 'h', defaultPrefix + defaultPrefix + 'help' ], + { + action: 'help', + defaultValue: c.SUPPRESS, + help: 'Show this help message and exit.' + } + ); + } + if (typeof this.version !== 'undefined') { + this.addArgument( + [ defaultPrefix + 'v', defaultPrefix + defaultPrefix + 'version' ], + { + action: 'version', + version: this.version, + defaultValue: c.SUPPRESS, + help: "Show program's version number and exit." + } + ); + } + + // add parent arguments and defaults + options.parents.forEach(function (parent) { + self._addContainerActions(parent); + if (typeof parent._defaults !== 'undefined') { + for (var defaultKey in parent._defaults) { + if (parent._defaults.hasOwnProperty(defaultKey)) { + self._defaults[defaultKey] = parent._defaults[defaultKey]; + } + } + } + }); +} + +util.inherits(ArgumentParser, ActionContainer); + +/** + * ArgumentParser#addSubparsers(options) -> [[ActionSubparsers]] + * - options (object): hash of options see [[ActionSubparsers.new]] + * + * See also [subcommands][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#sub-commands + **/ +ArgumentParser.prototype.addSubparsers = function (options) { + if (this._subparsers) { + this.error('Cannot have multiple subparser arguments.'); + } + + options = options || {}; + options.debug = (this.debug === true); + options.optionStrings = []; + options.parserClass = (options.parserClass || ArgumentParser); + + + if (!!options.title || !!options.description) { + + this._subparsers = this.addArgumentGroup({ + title: (options.title || 'subcommands'), + description: options.description + }); + delete options.title; + delete options.description; + + } else { + this._subparsers = this._positionals; + } + + // prog defaults to the usage message of this parser, skipping + // optional arguments and with no "usage:" prefix + if (!options.prog) { + var formatter = this._getFormatter(); + var positionals = this._getPositionalActions(); + var groups = this._mutuallyExclusiveGroups; + formatter.addUsage(this.usage, positionals, groups, ''); + options.prog = formatter.formatHelp().trim(); + } + + // create the parsers action and add it to the positionals list + var ParsersClass = this._popActionClass(options, 'parsers'); + var action = new ParsersClass(options); + this._subparsers._addAction(action); + + // return the created parsers action + return action; +}; + +ArgumentParser.prototype._addAction = function (action) { + if (action.isOptional()) { + this._optionals._addAction(action); + } else { + this._positionals._addAction(action); + } + return action; +}; + +ArgumentParser.prototype._getOptionalActions = function () { + return this._actions.filter(function (action) { + return action.isOptional(); + }); +}; + +ArgumentParser.prototype._getPositionalActions = function () { + return this._actions.filter(function (action) { + return action.isPositional(); + }); +}; + + +/** + * ArgumentParser#parseArgs(args, namespace) -> Namespace|Object + * - args (array): input elements + * - namespace (Namespace|Object): result object + * + * Parsed args and throws error if some arguments are not recognized + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#the-parse-args-method + **/ +ArgumentParser.prototype.parseArgs = function (args, namespace) { + var argv; + var result = this.parseKnownArgs(args, namespace); + + args = result[0]; + argv = result[1]; + if (argv && argv.length > 0) { + this.error( + format('Unrecognized arguments: %s.', argv.join(' ')) + ); + } + return args; +}; + +/** + * ArgumentParser#parseKnownArgs(args, namespace) -> array + * - args (array): input options + * - namespace (Namespace|Object): result object + * + * Parse known arguments and return tuple of result object + * and unknown args + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#partial-parsing + **/ +ArgumentParser.prototype.parseKnownArgs = function (args, namespace) { + var self = this; + + // args default to the system args + args = args || process.argv.slice(2); + + // default Namespace built from parser defaults + namespace = namespace || new Namespace(); + + self._actions.forEach(function (action) { + if (action.dest !== c.SUPPRESS) { + if (!$$.has(namespace, action.dest)) { + if (action.defaultValue !== c.SUPPRESS) { + var defaultValue = action.defaultValue; + if (typeof action.defaultValue === 'string') { + defaultValue = self._getValue(action, defaultValue); + } + namespace[action.dest] = defaultValue; + } + } + } + }); + + Object.keys(self._defaults).forEach(function (dest) { + namespace[dest] = self._defaults[dest]; + }); + + // parse the arguments and exit if there are any errors + try { + var res = this._parseKnownArgs(args, namespace); + + namespace = res[0]; + args = res[1]; + if ($$.has(namespace, c._UNRECOGNIZED_ARGS_ATTR)) { + args = $$.arrayUnion(args, namespace[c._UNRECOGNIZED_ARGS_ATTR]); + delete namespace[c._UNRECOGNIZED_ARGS_ATTR]; + } + return [ namespace, args ]; + } catch (e) { + this.error(e); + } +}; + +ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) { + var self = this; + + var extras = []; + + // replace arg strings that are file references + if (this.fromfilePrefixChars !== null) { + argStrings = this._readArgsFromFiles(argStrings); + } + // map all mutually exclusive arguments to the other arguments + // they can't occur with + // Python has 'conflicts = action_conflicts.setdefault(mutex_action, [])' + // though I can't conceive of a way in which an action could be a member + // of two different mutually exclusive groups. + + function actionHash(action) { + // some sort of hashable key for this action + // action itself cannot be a key in actionConflicts + // I think getName() (join of optionStrings) is unique enough + return action.getName(); + } + + var conflicts, key; + var actionConflicts = {}; + + this._mutuallyExclusiveGroups.forEach(function (mutexGroup) { + mutexGroup._groupActions.forEach(function (mutexAction, i, groupActions) { + key = actionHash(mutexAction); + if (!$$.has(actionConflicts, key)) { + actionConflicts[key] = []; + } + conflicts = actionConflicts[key]; + conflicts.push.apply(conflicts, groupActions.slice(0, i)); + conflicts.push.apply(conflicts, groupActions.slice(i + 1)); + }); + }); + + // find all option indices, and determine the arg_string_pattern + // which has an 'O' if there is an option at an index, + // an 'A' if there is an argument, or a '-' if there is a '--' + var optionStringIndices = {}; + + var argStringPatternParts = []; + + argStrings.forEach(function (argString, argStringIndex) { + if (argString === '--') { + argStringPatternParts.push('-'); + while (argStringIndex < argStrings.length) { + argStringPatternParts.push('A'); + argStringIndex++; + } + } else { + // otherwise, add the arg to the arg strings + // and note the index if it was an option + var pattern; + var optionTuple = self._parseOptional(argString); + if (!optionTuple) { + pattern = 'A'; + } else { + optionStringIndices[argStringIndex] = optionTuple; + pattern = 'O'; + } + argStringPatternParts.push(pattern); + } + }); + var argStringsPattern = argStringPatternParts.join(''); + + var seenActions = []; + var seenNonDefaultActions = []; + + + function takeAction(action, argumentStrings, optionString) { + seenActions.push(action); + var argumentValues = self._getValues(action, argumentStrings); + + // error if this argument is not allowed with other previously + // seen arguments, assuming that actions that use the default + // value don't really count as "present" + if (argumentValues !== action.defaultValue) { + seenNonDefaultActions.push(action); + if (actionConflicts[actionHash(action)]) { + actionConflicts[actionHash(action)].forEach(function (actionConflict) { + if (seenNonDefaultActions.indexOf(actionConflict) >= 0) { + throw argumentErrorHelper( + action, + format('Not allowed with argument "%s".', actionConflict.getName()) + ); + } + }); + } + } + + if (argumentValues !== c.SUPPRESS) { + action.call(self, namespace, argumentValues, optionString); + } + } + + function consumeOptional(startIndex) { + // get the optional identified at this index + var optionTuple = optionStringIndices[startIndex]; + var action = optionTuple[0]; + var optionString = optionTuple[1]; + var explicitArg = optionTuple[2]; + + // identify additional optionals in the same arg string + // (e.g. -xyz is the same as -x -y -z if no args are required) + var actionTuples = []; + + var args, argCount, start, stop; + + for (;;) { + if (!action) { + extras.push(argStrings[startIndex]); + return startIndex + 1; + } + if (explicitArg) { + argCount = self._matchArgument(action, 'A'); + + // if the action is a single-dash option and takes no + // arguments, try to parse more single-dash options out + // of the tail of the option string + var chars = self.prefixChars; + if (argCount === 0 && chars.indexOf(optionString[1]) < 0) { + actionTuples.push([ action, [], optionString ]); + optionString = optionString[0] + explicitArg[0]; + var newExplicitArg = explicitArg.slice(1) || null; + var optionalsMap = self._optionStringActions; + + if (Object.keys(optionalsMap).indexOf(optionString) >= 0) { + action = optionalsMap[optionString]; + explicitArg = newExplicitArg; + } else { + throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg)); + } + } else if (argCount === 1) { + // if the action expect exactly one argument, we've + // successfully matched the option; exit the loop + stop = startIndex + 1; + args = [ explicitArg ]; + actionTuples.push([ action, args, optionString ]); + break; + } else { + // error if a double-dash option did not use the + // explicit argument + throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg)); + } + } else { + // if there is no explicit argument, try to match the + // optional's string arguments with the following strings + // if successful, exit the loop + + start = startIndex + 1; + var selectedPatterns = argStringsPattern.substr(start); + + argCount = self._matchArgument(action, selectedPatterns); + stop = start + argCount; + + + args = argStrings.slice(start, stop); + + actionTuples.push([ action, args, optionString ]); + break; + } + + } + + // add the Optional to the list and return the index at which + // the Optional's string args stopped + if (actionTuples.length < 1) { + throw new Error('length should be > 0'); + } + for (var i = 0; i < actionTuples.length; i++) { + takeAction.apply(self, actionTuples[i]); + } + return stop; + } + + // the list of Positionals left to be parsed; this is modified + // by consume_positionals() + var positionals = self._getPositionalActions(); + + function consumePositionals(startIndex) { + // match as many Positionals as possible + var selectedPattern = argStringsPattern.substr(startIndex); + var argCounts = self._matchArgumentsPartial(positionals, selectedPattern); + + // slice off the appropriate arg strings for each Positional + // and add the Positional and its args to the list + for (var i = 0; i < positionals.length; i++) { + var action = positionals[i]; + var argCount = argCounts[i]; + if (typeof argCount === 'undefined') { + continue; + } + var args = argStrings.slice(startIndex, startIndex + argCount); + + startIndex += argCount; + takeAction(action, args); + } + + // slice off the Positionals that we just parsed and return the + // index at which the Positionals' string args stopped + positionals = positionals.slice(argCounts.length); + return startIndex; + } + + // consume Positionals and Optionals alternately, until we have + // passed the last option string + var startIndex = 0; + var position; + + var maxOptionStringIndex = -1; + + Object.keys(optionStringIndices).forEach(function (position) { + maxOptionStringIndex = Math.max(maxOptionStringIndex, parseInt(position, 10)); + }); + + var positionalsEndIndex, nextOptionStringIndex; + + while (startIndex <= maxOptionStringIndex) { + // consume any Positionals preceding the next option + nextOptionStringIndex = null; + for (position in optionStringIndices) { + if (!optionStringIndices.hasOwnProperty(position)) { continue; } + + position = parseInt(position, 10); + if (position >= startIndex) { + if (nextOptionStringIndex !== null) { + nextOptionStringIndex = Math.min(nextOptionStringIndex, position); + } else { + nextOptionStringIndex = position; + } + } + } + + if (startIndex !== nextOptionStringIndex) { + positionalsEndIndex = consumePositionals(startIndex); + // only try to parse the next optional if we didn't consume + // the option string during the positionals parsing + if (positionalsEndIndex > startIndex) { + startIndex = positionalsEndIndex; + continue; + } else { + startIndex = positionalsEndIndex; + } + } + + // if we consumed all the positionals we could and we're not + // at the index of an option string, there were extra arguments + if (!optionStringIndices[startIndex]) { + var strings = argStrings.slice(startIndex, nextOptionStringIndex); + extras = extras.concat(strings); + startIndex = nextOptionStringIndex; + } + // consume the next optional and any arguments for it + startIndex = consumeOptional(startIndex); + } + + // consume any positionals following the last Optional + var stopIndex = consumePositionals(startIndex); + + // if we didn't consume all the argument strings, there were extras + extras = extras.concat(argStrings.slice(stopIndex)); + + // if we didn't use all the Positional objects, there were too few + // arg strings supplied. + if (positionals.length > 0) { + self.error('too few arguments'); + } + + // make sure all required actions were present + self._actions.forEach(function (action) { + if (action.required) { + if (seenActions.indexOf(action) < 0) { + self.error(format('Argument "%s" is required', action.getName())); + } + } + }); + + // make sure all required groups have one option present + var actionUsed = false; + self._mutuallyExclusiveGroups.forEach(function (group) { + if (group.required) { + actionUsed = group._groupActions.some(function (action) { + return seenNonDefaultActions.indexOf(action) !== -1; + }); + + // if no actions were used, report the error + if (!actionUsed) { + var names = []; + group._groupActions.forEach(function (action) { + if (action.help !== c.SUPPRESS) { + names.push(action.getName()); + } + }); + names = names.join(' '); + var msg = 'one of the arguments ' + names + ' is required'; + self.error(msg); + } + } + }); + + // return the updated namespace and the extra arguments + return [ namespace, extras ]; +}; + +ArgumentParser.prototype._readArgsFromFiles = function (argStrings) { + // expand arguments referencing files + var self = this; + var fs = require('fs'); + var newArgStrings = []; + argStrings.forEach(function (argString) { + if (self.fromfilePrefixChars.indexOf(argString[0]) < 0) { + // for regular arguments, just add them back into the list + newArgStrings.push(argString); + } else { + // replace arguments referencing files with the file content + try { + var argstrs = []; + var filename = argString.slice(1); + var content = fs.readFileSync(filename, 'utf8'); + content = content.trim().split('\n'); + content.forEach(function (argLine) { + self.convertArgLineToArgs(argLine).forEach(function (arg) { + argstrs.push(arg); + }); + argstrs = self._readArgsFromFiles(argstrs); + }); + newArgStrings.push.apply(newArgStrings, argstrs); + } catch (error) { + return self.error(error.message); + } + } + }); + return newArgStrings; +}; + +ArgumentParser.prototype.convertArgLineToArgs = function (argLine) { + return [ argLine ]; +}; + +ArgumentParser.prototype._matchArgument = function (action, regexpArgStrings) { + + // match the pattern for this action to the arg strings + var regexpNargs = new RegExp('^' + this._getNargsPattern(action)); + var matches = regexpArgStrings.match(regexpNargs); + var message; + + // throw an exception if we weren't able to find a match + if (!matches) { + switch (action.nargs) { + /*eslint-disable no-undefined*/ + case undefined: + case null: + message = 'Expected one argument.'; + break; + case c.OPTIONAL: + message = 'Expected at most one argument.'; + break; + case c.ONE_OR_MORE: + message = 'Expected at least one argument.'; + break; + default: + message = 'Expected %s argument(s)'; + } + + throw argumentErrorHelper( + action, + format(message, action.nargs) + ); + } + // return the number of arguments matched + return matches[1].length; +}; + +ArgumentParser.prototype._matchArgumentsPartial = function (actions, regexpArgStrings) { + // progressively shorten the actions list by slicing off the + // final actions until we find a match + var self = this; + var result = []; + var actionSlice, pattern, matches; + var i, j; + + function getLength(string) { + return string.length; + } + + for (i = actions.length; i > 0; i--) { + pattern = ''; + actionSlice = actions.slice(0, i); + for (j = 0; j < actionSlice.length; j++) { + pattern += self._getNargsPattern(actionSlice[j]); + } + + pattern = new RegExp('^' + pattern); + matches = regexpArgStrings.match(pattern); + + if (matches && matches.length > 0) { + // need only groups + matches = matches.splice(1); + result = result.concat(matches.map(getLength)); + break; + } + } + + // return the list of arg string counts + return result; +}; + +ArgumentParser.prototype._parseOptional = function (argString) { + var action, optionString, argExplicit, optionTuples; + + // if it's an empty string, it was meant to be a positional + if (!argString) { + return null; + } + + // if it doesn't start with a prefix, it was meant to be positional + if (this.prefixChars.indexOf(argString[0]) < 0) { + return null; + } + + // if the option string is present in the parser, return the action + if (this._optionStringActions[argString]) { + return [ this._optionStringActions[argString], argString, null ]; + } + + // if it's just a single character, it was meant to be positional + if (argString.length === 1) { + return null; + } + + // if the option string before the "=" is present, return the action + if (argString.indexOf('=') >= 0) { + optionString = argString.split('=', 1)[0]; + argExplicit = argString.slice(optionString.length + 1); + + if (this._optionStringActions[optionString]) { + action = this._optionStringActions[optionString]; + return [ action, optionString, argExplicit ]; + } + } + + // search through all possible prefixes of the option string + // and all actions in the parser for possible interpretations + optionTuples = this._getOptionTuples(argString); + + // if multiple actions match, the option string was ambiguous + if (optionTuples.length > 1) { + var optionStrings = optionTuples.map(function (optionTuple) { + return optionTuple[1]; + }); + this.error(format( + 'Ambiguous option: "%s" could match %s.', + argString, optionStrings.join(', ') + )); + // if exactly one action matched, this segmentation is good, + // so return the parsed action + } else if (optionTuples.length === 1) { + return optionTuples[0]; + } + + // if it was not found as an option, but it looks like a negative + // number, it was meant to be positional + // unless there are negative-number-like options + if (argString.match(this._regexpNegativeNumber)) { + if (!this._hasNegativeNumberOptionals.some(Boolean)) { + return null; + } + } + // if it contains a space, it was meant to be a positional + if (argString.search(' ') >= 0) { + return null; + } + + // it was meant to be an optional but there is no such option + // in this parser (though it might be a valid option in a subparser) + return [ null, argString, null ]; +}; + +ArgumentParser.prototype._getOptionTuples = function (optionString) { + var result = []; + var chars = this.prefixChars; + var optionPrefix; + var argExplicit; + var action; + var actionOptionString; + + // option strings starting with two prefix characters are only split at + // the '=' + if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) >= 0) { + if (optionString.indexOf('=') >= 0) { + var optionStringSplit = optionString.split('=', 1); + + optionPrefix = optionStringSplit[0]; + argExplicit = optionStringSplit[1]; + } else { + optionPrefix = optionString; + argExplicit = null; + } + + for (actionOptionString in this._optionStringActions) { + if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) { + action = this._optionStringActions[actionOptionString]; + result.push([ action, actionOptionString, argExplicit ]); + } + } + + // single character options can be concatenated with their arguments + // but multiple character options always have to have their argument + // separate + } else if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) < 0) { + optionPrefix = optionString; + argExplicit = null; + var optionPrefixShort = optionString.substr(0, 2); + var argExplicitShort = optionString.substr(2); + + for (actionOptionString in this._optionStringActions) { + if (!$$.has(this._optionStringActions, actionOptionString)) continue; + + action = this._optionStringActions[actionOptionString]; + if (actionOptionString === optionPrefixShort) { + result.push([ action, actionOptionString, argExplicitShort ]); + } else if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) { + result.push([ action, actionOptionString, argExplicit ]); + } + } + + // shouldn't ever get here + } else { + throw new Error(format('Unexpected option string: %s.', optionString)); + } + // return the collected option tuples + return result; +}; + +ArgumentParser.prototype._getNargsPattern = function (action) { + // in all examples below, we have to allow for '--' args + // which are represented as '-' in the pattern + var regexpNargs; + + switch (action.nargs) { + // the default (null) is assumed to be a single argument + case undefined: + case null: + regexpNargs = '(-*A-*)'; + break; + // allow zero or more arguments + case c.OPTIONAL: + regexpNargs = '(-*A?-*)'; + break; + // allow zero or more arguments + case c.ZERO_OR_MORE: + regexpNargs = '(-*[A-]*)'; + break; + // allow one or more arguments + case c.ONE_OR_MORE: + regexpNargs = '(-*A[A-]*)'; + break; + // allow any number of options or arguments + case c.REMAINDER: + regexpNargs = '([-AO]*)'; + break; + // allow one argument followed by any number of options or arguments + case c.PARSER: + regexpNargs = '(-*A[-AO]*)'; + break; + // all others should be integers + default: + regexpNargs = '(-*' + $$.repeat('-*A', action.nargs) + '-*)'; + } + + // if this is an optional action, -- is not allowed + if (action.isOptional()) { + regexpNargs = regexpNargs.replace(/-\*/g, ''); + regexpNargs = regexpNargs.replace(/-/g, ''); + } + + // return the pattern + return regexpNargs; +}; + +// +// Value conversion methods +// + +ArgumentParser.prototype._getValues = function (action, argStrings) { + var self = this; + + // for everything but PARSER args, strip out '--' + if (action.nargs !== c.PARSER && action.nargs !== c.REMAINDER) { + argStrings = argStrings.filter(function (arrayElement) { + return arrayElement !== '--'; + }); + } + + var value, argString; + + // optional argument produces a default when not present + if (argStrings.length === 0 && action.nargs === c.OPTIONAL) { + + value = (action.isOptional()) ? action.constant : action.defaultValue; + + if (typeof (value) === 'string') { + value = this._getValue(action, value); + this._checkValue(action, value); + } + + // when nargs='*' on a positional, if there were no command-line + // args, use the default if it is anything other than None + } else if (argStrings.length === 0 && action.nargs === c.ZERO_OR_MORE && + action.optionStrings.length === 0) { + + value = (action.defaultValue || argStrings); + this._checkValue(action, value); + + // single argument or optional argument produces a single value + } else if (argStrings.length === 1 && + (!action.nargs || action.nargs === c.OPTIONAL)) { + + argString = argStrings[0]; + value = this._getValue(action, argString); + this._checkValue(action, value); + + // REMAINDER arguments convert all values, checking none + } else if (action.nargs === c.REMAINDER) { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + + // PARSER arguments convert all values, but check only the first + } else if (action.nargs === c.PARSER) { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + this._checkValue(action, value[0]); + + // all other types of nargs produce a list + } else { + value = argStrings.map(function (v) { + return self._getValue(action, v); + }); + value.forEach(function (v) { + self._checkValue(action, v); + }); + } + + // return the converted value + return value; +}; + +ArgumentParser.prototype._getValue = function (action, argString) { + var result; + + var typeFunction = this._registryGet('type', action.type, action.type); + if (typeof typeFunction !== 'function') { + var message = format('%s is not callable', typeFunction); + throw argumentErrorHelper(action, message); + } + + // convert the value to the appropriate type + try { + result = typeFunction(argString); + + // ArgumentTypeErrors indicate errors + // If action.type is not a registered string, it is a function + // Try to deduce its name for inclusion in the error message + // Failing that, include the error message it raised. + } catch (e) { + var name = null; + if (typeof action.type === 'string') { + name = action.type; + } else { + name = action.type.name || action.type.displayName || ''; + } + var msg = format('Invalid %s value: %s', name, argString); + if (name === '') { msg += '\n' + e.message; } + throw argumentErrorHelper(action, msg); + } + // return the converted value + return result; +}; + +ArgumentParser.prototype._checkValue = function (action, value) { + // converted value must be one of the choices (if specified) + var choices = action.choices; + if (choices) { + // choise for argument can by array or string + if ((typeof choices === 'string' || Array.isArray(choices)) && + choices.indexOf(value) !== -1) { + return; + } + // choise for subparsers can by only hash + if (typeof choices === 'object' && !Array.isArray(choices) && choices[value]) { + return; + } + + if (typeof choices === 'string') { + choices = choices.split('').join(', '); + } else if (Array.isArray(choices)) { + choices = choices.join(', '); + } else { + choices = Object.keys(choices).join(', '); + } + var message = format('Invalid choice: %s (choose from [%s])', value, choices); + throw argumentErrorHelper(action, message); + } +}; + +// +// Help formatting methods +// + +/** + * ArgumentParser#formatUsage -> string + * + * Return usage string + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.formatUsage = function () { + var formatter = this._getFormatter(); + formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups); + return formatter.formatHelp(); +}; + +/** + * ArgumentParser#formatHelp -> string + * + * Return help + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.formatHelp = function () { + var formatter = this._getFormatter(); + + // usage + formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups); + + // description + formatter.addText(this.description); + + // positionals, optionals and user-defined groups + this._actionGroups.forEach(function (actionGroup) { + formatter.startSection(actionGroup.title); + formatter.addText(actionGroup.description); + formatter.addArguments(actionGroup._groupActions); + formatter.endSection(); + }); + + // epilog + formatter.addText(this.epilog); + + // determine help from format above + return formatter.formatHelp(); +}; + +ArgumentParser.prototype._getFormatter = function () { + var FormatterClass = this.formatterClass; + var formatter = new FormatterClass({ prog: this.prog }); + return formatter; +}; + +// +// Print functions +// + +/** + * ArgumentParser#printUsage() -> Void + * + * Print usage + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.printUsage = function () { + this._printMessage(this.formatUsage()); +}; + +/** + * ArgumentParser#printHelp() -> Void + * + * Print help + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#printing-help + **/ +ArgumentParser.prototype.printHelp = function () { + this._printMessage(this.formatHelp()); +}; + +ArgumentParser.prototype._printMessage = function (message, stream) { + if (!stream) { + stream = process.stdout; + } + if (message) { + stream.write('' + message); + } +}; + +// +// Exit functions +// + +/** + * ArgumentParser#exit(status=0, message) -> Void + * - status (int): exit status + * - message (string): message + * + * Print message in stderr/stdout and exit program + **/ +ArgumentParser.prototype.exit = function (status, message) { + if (message) { + if (status === 0) { + this._printMessage(message); + } else { + this._printMessage(message, process.stderr); + } + } + + process.exit(status); +}; + +/** + * ArgumentParser#error(message) -> Void + * - err (Error|string): message + * + * Error method Prints a usage message incorporating the message to stderr and + * exits. If you override this in a subclass, + * it should not return -- it should + * either exit or throw an exception. + * + **/ +ArgumentParser.prototype.error = function (err) { + var message; + if (err instanceof Error) { + if (this.debug === true) { + throw err; + } + message = err.message; + } else { + message = err; + } + var msg = format('%s: error: %s', this.prog, message) + c.EOL; + + if (this.debug === true) { + throw new Error(msg); + } + + this.printUsage(process.stderr); + + return this.exit(2, msg); +}; + +module.exports = ArgumentParser; diff --git a/node_modules/argparse/lib/const.js b/node_modules/argparse/lib/const.js new file mode 100644 index 00000000..b1fd4ced --- /dev/null +++ b/node_modules/argparse/lib/const.js @@ -0,0 +1,21 @@ +// +// Constants +// + +'use strict'; + +module.exports.EOL = '\n'; + +module.exports.SUPPRESS = '==SUPPRESS=='; + +module.exports.OPTIONAL = '?'; + +module.exports.ZERO_OR_MORE = '*'; + +module.exports.ONE_OR_MORE = '+'; + +module.exports.PARSER = 'A...'; + +module.exports.REMAINDER = '...'; + +module.exports._UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args'; diff --git a/node_modules/argparse/lib/help/added_formatters.js b/node_modules/argparse/lib/help/added_formatters.js new file mode 100644 index 00000000..f8e42998 --- /dev/null +++ b/node_modules/argparse/lib/help/added_formatters.js @@ -0,0 +1,87 @@ +'use strict'; + +var util = require('util'); + +// Constants +var c = require('../const'); + +var $$ = require('../utils'); +var HelpFormatter = require('./formatter.js'); + +/** + * new RawDescriptionHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...}) + * + * Help message formatter which adds default values to argument help. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +function ArgumentDefaultsHelpFormatter(options) { + HelpFormatter.call(this, options); +} + +util.inherits(ArgumentDefaultsHelpFormatter, HelpFormatter); + +ArgumentDefaultsHelpFormatter.prototype._getHelpString = function (action) { + var help = action.help; + if (action.help.indexOf('%(defaultValue)s') === -1) { + if (action.defaultValue !== c.SUPPRESS) { + var defaulting_nargs = [ c.OPTIONAL, c.ZERO_OR_MORE ]; + if (action.isOptional() || (defaulting_nargs.indexOf(action.nargs) >= 0)) { + help += ' (default: %(defaultValue)s)'; + } + } + } + return help; +}; + +module.exports.ArgumentDefaultsHelpFormatter = ArgumentDefaultsHelpFormatter; + +/** + * new RawDescriptionHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...}) + * + * Help message formatter which retains any formatting in descriptions. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +function RawDescriptionHelpFormatter(options) { + HelpFormatter.call(this, options); +} + +util.inherits(RawDescriptionHelpFormatter, HelpFormatter); + +RawDescriptionHelpFormatter.prototype._fillText = function (text, width, indent) { + var lines = text.split('\n'); + lines = lines.map(function (line) { + return $$.trimEnd(indent + line); + }); + return lines.join('\n'); +}; +module.exports.RawDescriptionHelpFormatter = RawDescriptionHelpFormatter; + +/** + * new RawTextHelpFormatter(options) + * new ArgumentParser({formatterClass: argparse.RawTextHelpFormatter, ...}) + * + * Help message formatter which retains formatting of all help text. + * + * Only the name of this class is considered a public API. All the methods + * provided by the class are considered an implementation detail. + **/ + +function RawTextHelpFormatter(options) { + RawDescriptionHelpFormatter.call(this, options); +} + +util.inherits(RawTextHelpFormatter, RawDescriptionHelpFormatter); + +RawTextHelpFormatter.prototype._splitLines = function (text) { + return text.split('\n'); +}; + +module.exports.RawTextHelpFormatter = RawTextHelpFormatter; diff --git a/node_modules/argparse/lib/help/formatter.js b/node_modules/argparse/lib/help/formatter.js new file mode 100644 index 00000000..29036c14 --- /dev/null +++ b/node_modules/argparse/lib/help/formatter.js @@ -0,0 +1,795 @@ +/** + * class HelpFormatter + * + * Formatter for generating usage messages and argument help strings. Only the + * name of this class is considered a public API. All the methods provided by + * the class are considered an implementation detail. + * + * Do not call in your code, use this class only for inherits your own forvatter + * + * ToDo add [additonal formatters][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#formatter-class + **/ +'use strict'; + +var sprintf = require('sprintf-js').sprintf; + +// Constants +var c = require('../const'); + +var $$ = require('../utils'); + + +/*:nodoc:* internal + * new Support(parent, heding) + * - parent (object): parent section + * - heading (string): header string + * + **/ +function Section(parent, heading) { + this._parent = parent; + this._heading = heading; + this._items = []; +} + +/*:nodoc:* internal + * Section#addItem(callback) -> Void + * - callback (array): tuple with function and args + * + * Add function for single element + **/ +Section.prototype.addItem = function (callback) { + this._items.push(callback); +}; + +/*:nodoc:* internal + * Section#formatHelp(formatter) -> string + * - formatter (HelpFormatter): current formatter + * + * Form help section string + * + **/ +Section.prototype.formatHelp = function (formatter) { + var itemHelp, heading; + + // format the indented section + if (this._parent) { + formatter._indent(); + } + + itemHelp = this._items.map(function (item) { + var obj, func, args; + + obj = formatter; + func = item[0]; + args = item[1]; + return func.apply(obj, args); + }); + itemHelp = formatter._joinParts(itemHelp); + + if (this._parent) { + formatter._dedent(); + } + + // return nothing if the section was empty + if (!itemHelp) { + return ''; + } + + // add the heading if the section was non-empty + heading = ''; + if (this._heading && this._heading !== c.SUPPRESS) { + var currentIndent = formatter.currentIndent; + heading = $$.repeat(' ', currentIndent) + this._heading + ':' + c.EOL; + } + + // join the section-initialize newline, the heading and the help + return formatter._joinParts([ c.EOL, heading, itemHelp, c.EOL ]); +}; + +/** + * new HelpFormatter(options) + * + * #### Options: + * - `prog`: program name + * - `indentIncriment`: indent step, default value 2 + * - `maxHelpPosition`: max help position, default value = 24 + * - `width`: line width + * + **/ +var HelpFormatter = module.exports = function HelpFormatter(options) { + options = options || {}; + + this._prog = options.prog; + + this._maxHelpPosition = options.maxHelpPosition || 24; + this._width = (options.width || ((process.env.COLUMNS || 80) - 2)); + + this._currentIndent = 0; + this._indentIncriment = options.indentIncriment || 2; + this._level = 0; + this._actionMaxLength = 0; + + this._rootSection = new Section(null); + this._currentSection = this._rootSection; + + this._whitespaceMatcher = new RegExp('\\s+', 'g'); + this._longBreakMatcher = new RegExp(c.EOL + c.EOL + c.EOL + '+', 'g'); +}; + +HelpFormatter.prototype._indent = function () { + this._currentIndent += this._indentIncriment; + this._level += 1; +}; + +HelpFormatter.prototype._dedent = function () { + this._currentIndent -= this._indentIncriment; + this._level -= 1; + if (this._currentIndent < 0) { + throw new Error('Indent decreased below 0.'); + } +}; + +HelpFormatter.prototype._addItem = function (func, args) { + this._currentSection.addItem([ func, args ]); +}; + +// +// Message building methods +// + +/** + * HelpFormatter#startSection(heading) -> Void + * - heading (string): header string + * + * Start new help section + * + * See alse [code example][1] + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.startSection = function (heading) { + this._indent(); + var section = new Section(this._currentSection, heading); + var func = section.formatHelp.bind(section); + this._addItem(func, [ this ]); + this._currentSection = section; +}; + +/** + * HelpFormatter#endSection -> Void + * + * End help section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + **/ +HelpFormatter.prototype.endSection = function () { + this._currentSection = this._currentSection._parent; + this._dedent(); +}; + +/** + * HelpFormatter#addText(text) -> Void + * - text (string): plain text + * + * Add plain text into current section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.addText = function (text) { + if (text && text !== c.SUPPRESS) { + this._addItem(this._formatText, [ text ]); + } +}; + +/** + * HelpFormatter#addUsage(usage, actions, groups, prefix) -> Void + * - usage (string): usage text + * - actions (array): actions list + * - groups (array): groups list + * - prefix (string): usage prefix + * + * Add usage data into current section + * + * ##### Example + * + * formatter.addUsage(this.usage, this._actions, []); + * return formatter.formatHelp(); + * + **/ +HelpFormatter.prototype.addUsage = function (usage, actions, groups, prefix) { + if (usage !== c.SUPPRESS) { + this._addItem(this._formatUsage, [ usage, actions, groups, prefix ]); + } +}; + +/** + * HelpFormatter#addArgument(action) -> Void + * - action (object): action + * + * Add argument into current section + * + * Single variant of [[HelpFormatter#addArguments]] + **/ +HelpFormatter.prototype.addArgument = function (action) { + if (action.help !== c.SUPPRESS) { + var self = this; + + // find all invocations + var invocations = [ this._formatActionInvocation(action) ]; + var invocationLength = invocations[0].length; + + var actionLength; + + if (action._getSubactions) { + this._indent(); + action._getSubactions().forEach(function (subaction) { + + var invocationNew = self._formatActionInvocation(subaction); + invocations.push(invocationNew); + invocationLength = Math.max(invocationLength, invocationNew.length); + + }); + this._dedent(); + } + + // update the maximum item length + actionLength = invocationLength + this._currentIndent; + this._actionMaxLength = Math.max(this._actionMaxLength, actionLength); + + // add the item to the list + this._addItem(this._formatAction, [ action ]); + } +}; + +/** + * HelpFormatter#addArguments(actions) -> Void + * - actions (array): actions list + * + * Mass add arguments into current section + * + * ##### Example + * + * formatter.startSection(actionGroup.title); + * formatter.addText(actionGroup.description); + * formatter.addArguments(actionGroup._groupActions); + * formatter.endSection(); + * + **/ +HelpFormatter.prototype.addArguments = function (actions) { + var self = this; + actions.forEach(function (action) { + self.addArgument(action); + }); +}; + +// +// Help-formatting methods +// + +/** + * HelpFormatter#formatHelp -> string + * + * Format help + * + * ##### Example + * + * formatter.addText(this.epilog); + * return formatter.formatHelp(); + * + **/ +HelpFormatter.prototype.formatHelp = function () { + var help = this._rootSection.formatHelp(this); + if (help) { + help = help.replace(this._longBreakMatcher, c.EOL + c.EOL); + help = $$.trimChars(help, c.EOL) + c.EOL; + } + return help; +}; + +HelpFormatter.prototype._joinParts = function (partStrings) { + return partStrings.filter(function (part) { + return (part && part !== c.SUPPRESS); + }).join(''); +}; + +HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix) { + if (!prefix && typeof prefix !== 'string') { + prefix = 'usage: '; + } + + actions = actions || []; + groups = groups || []; + + + // if usage is specified, use that + if (usage) { + usage = sprintf(usage, { prog: this._prog }); + + // if no optionals or positionals are available, usage is just prog + } else if (!usage && actions.length === 0) { + usage = this._prog; + + // if optionals and positionals are available, calculate usage + } else if (!usage) { + var prog = this._prog; + var optionals = []; + var positionals = []; + var actionUsage; + var textWidth; + + // split optionals from positionals + actions.forEach(function (action) { + if (action.isOptional()) { + optionals.push(action); + } else { + positionals.push(action); + } + }); + + // build full usage string + actionUsage = this._formatActionsUsage([].concat(optionals, positionals), groups); + usage = [ prog, actionUsage ].join(' '); + + // wrap the usage parts if it's too long + textWidth = this._width - this._currentIndent; + if ((prefix.length + usage.length) > textWidth) { + + // break usage into wrappable parts + var regexpPart = new RegExp('\\(.*?\\)+|\\[.*?\\]+|\\S+', 'g'); + var optionalUsage = this._formatActionsUsage(optionals, groups); + var positionalUsage = this._formatActionsUsage(positionals, groups); + + + var optionalParts = optionalUsage.match(regexpPart); + var positionalParts = positionalUsage.match(regexpPart) || []; + + if (optionalParts.join(' ') !== optionalUsage) { + throw new Error('assert "optionalParts.join(\' \') === optionalUsage"'); + } + if (positionalParts.join(' ') !== positionalUsage) { + throw new Error('assert "positionalParts.join(\' \') === positionalUsage"'); + } + + // helper for wrapping lines + /*eslint-disable func-style*/ // node 0.10 compat + var _getLines = function (parts, indent, prefix) { + var lines = []; + var line = []; + + var lineLength = prefix ? prefix.length - 1 : indent.length - 1; + + parts.forEach(function (part) { + if (lineLength + 1 + part.length > textWidth) { + lines.push(indent + line.join(' ')); + line = []; + lineLength = indent.length - 1; + } + line.push(part); + lineLength += part.length + 1; + }); + + if (line) { + lines.push(indent + line.join(' ')); + } + if (prefix) { + lines[0] = lines[0].substr(indent.length); + } + return lines; + }; + + var lines, indent, parts; + // if prog is short, follow it with optionals or positionals + if (prefix.length + prog.length <= 0.75 * textWidth) { + indent = $$.repeat(' ', (prefix.length + prog.length + 1)); + if (optionalParts) { + lines = [].concat( + _getLines([ prog ].concat(optionalParts), indent, prefix), + _getLines(positionalParts, indent) + ); + } else if (positionalParts) { + lines = _getLines([ prog ].concat(positionalParts), indent, prefix); + } else { + lines = [ prog ]; + } + + // if prog is long, put it on its own line + } else { + indent = $$.repeat(' ', prefix.length); + parts = optionalParts.concat(positionalParts); + lines = _getLines(parts, indent); + if (lines.length > 1) { + lines = [].concat( + _getLines(optionalParts, indent), + _getLines(positionalParts, indent) + ); + } + lines = [ prog ].concat(lines); + } + // join lines into usage + usage = lines.join(c.EOL); + } + } + + // prefix with 'usage:' + return prefix + usage + c.EOL + c.EOL; +}; + +HelpFormatter.prototype._formatActionsUsage = function (actions, groups) { + // find group indices and identify actions in groups + var groupActions = []; + var inserts = []; + var self = this; + + groups.forEach(function (group) { + var end; + var i; + + var start = actions.indexOf(group._groupActions[0]); + if (start >= 0) { + end = start + group._groupActions.length; + + //if (actions.slice(start, end) === group._groupActions) { + if ($$.arrayEqual(actions.slice(start, end), group._groupActions)) { + group._groupActions.forEach(function (action) { + groupActions.push(action); + }); + + if (!group.required) { + if (inserts[start]) { + inserts[start] += ' ['; + } else { + inserts[start] = '['; + } + inserts[end] = ']'; + } else { + if (inserts[start]) { + inserts[start] += ' ('; + } else { + inserts[start] = '('; + } + inserts[end] = ')'; + } + for (i = start + 1; i < end; i += 1) { + inserts[i] = '|'; + } + } + } + }); + + // collect all actions format strings + var parts = []; + + actions.forEach(function (action, actionIndex) { + var part; + var optionString; + var argsDefault; + var argsString; + + // suppressed arguments are marked with None + // remove | separators for suppressed arguments + if (action.help === c.SUPPRESS) { + parts.push(null); + if (inserts[actionIndex] === '|') { + inserts.splice(actionIndex, actionIndex); + } else if (inserts[actionIndex + 1] === '|') { + inserts.splice(actionIndex + 1, actionIndex + 1); + } + + // produce all arg strings + } else if (!action.isOptional()) { + part = self._formatArgs(action, action.dest); + + // if it's in a group, strip the outer [] + if (groupActions.indexOf(action) >= 0) { + if (part[0] === '[' && part[part.length - 1] === ']') { + part = part.slice(1, -1); + } + } + // add the action string to the list + parts.push(part); + + // produce the first way to invoke the option in brackets + } else { + optionString = action.optionStrings[0]; + + // if the Optional doesn't take a value, format is: -s or --long + if (action.nargs === 0) { + part = '' + optionString; + + // if the Optional takes a value, format is: -s ARGS or --long ARGS + } else { + argsDefault = action.dest.toUpperCase(); + argsString = self._formatArgs(action, argsDefault); + part = optionString + ' ' + argsString; + } + // make it look optional if it's not required or in a group + if (!action.required && groupActions.indexOf(action) < 0) { + part = '[' + part + ']'; + } + // add the action string to the list + parts.push(part); + } + }); + + // insert things at the necessary indices + for (var i = inserts.length - 1; i >= 0; --i) { + if (inserts[i] !== null) { + parts.splice(i, 0, inserts[i]); + } + } + + // join all the action items with spaces + var text = parts.filter(function (part) { + return !!part; + }).join(' '); + + // clean up separators for mutually exclusive groups + text = text.replace(/([\[(]) /g, '$1'); // remove spaces + text = text.replace(/ ([\])])/g, '$1'); + text = text.replace(/\[ *\]/g, ''); // remove empty groups + text = text.replace(/\( *\)/g, ''); + text = text.replace(/\(([^|]*)\)/g, '$1'); // remove () from single action groups + + text = text.trim(); + + // return the text + return text; +}; + +HelpFormatter.prototype._formatText = function (text) { + text = sprintf(text, { prog: this._prog }); + var textWidth = this._width - this._currentIndent; + var indentIncriment = $$.repeat(' ', this._currentIndent); + return this._fillText(text, textWidth, indentIncriment) + c.EOL + c.EOL; +}; + +HelpFormatter.prototype._formatAction = function (action) { + var self = this; + + var helpText; + var helpLines; + var parts; + var indentFirst; + + // determine the required width and the entry label + var helpPosition = Math.min(this._actionMaxLength + 2, this._maxHelpPosition); + var helpWidth = this._width - helpPosition; + var actionWidth = helpPosition - this._currentIndent - 2; + var actionHeader = this._formatActionInvocation(action); + + // no help; start on same line and add a final newline + if (!action.help) { + actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL; + + // short action name; start on the same line and pad two spaces + } else if (actionHeader.length <= actionWidth) { + actionHeader = $$.repeat(' ', this._currentIndent) + + actionHeader + + ' ' + + $$.repeat(' ', actionWidth - actionHeader.length); + indentFirst = 0; + + // long action name; start on the next line + } else { + actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL; + indentFirst = helpPosition; + } + + // collect the pieces of the action help + parts = [ actionHeader ]; + + // if there was help for the action, add lines of help text + if (action.help) { + helpText = this._expandHelp(action); + helpLines = this._splitLines(helpText, helpWidth); + parts.push($$.repeat(' ', indentFirst) + helpLines[0] + c.EOL); + helpLines.slice(1).forEach(function (line) { + parts.push($$.repeat(' ', helpPosition) + line + c.EOL); + }); + + // or add a newline if the description doesn't end with one + } else if (actionHeader.charAt(actionHeader.length - 1) !== c.EOL) { + parts.push(c.EOL); + } + // if there are any sub-actions, add their help as well + if (action._getSubactions) { + this._indent(); + action._getSubactions().forEach(function (subaction) { + parts.push(self._formatAction(subaction)); + }); + this._dedent(); + } + // return a single string + return this._joinParts(parts); +}; + +HelpFormatter.prototype._formatActionInvocation = function (action) { + if (!action.isOptional()) { + var format_func = this._metavarFormatter(action, action.dest); + var metavars = format_func(1); + return metavars[0]; + } + + var parts = []; + var argsDefault; + var argsString; + + // if the Optional doesn't take a value, format is: -s, --long + if (action.nargs === 0) { + parts = parts.concat(action.optionStrings); + + // if the Optional takes a value, format is: -s ARGS, --long ARGS + } else { + argsDefault = action.dest.toUpperCase(); + argsString = this._formatArgs(action, argsDefault); + action.optionStrings.forEach(function (optionString) { + parts.push(optionString + ' ' + argsString); + }); + } + return parts.join(', '); +}; + +HelpFormatter.prototype._metavarFormatter = function (action, metavarDefault) { + var result; + + if (action.metavar || action.metavar === '') { + result = action.metavar; + } else if (action.choices) { + var choices = action.choices; + + if (typeof choices === 'string') { + choices = choices.split('').join(', '); + } else if (Array.isArray(choices)) { + choices = choices.join(','); + } else { + choices = Object.keys(choices).join(','); + } + result = '{' + choices + '}'; + } else { + result = metavarDefault; + } + + return function (size) { + if (Array.isArray(result)) { + return result; + } + + var metavars = []; + for (var i = 0; i < size; i += 1) { + metavars.push(result); + } + return metavars; + }; +}; + +HelpFormatter.prototype._formatArgs = function (action, metavarDefault) { + var result; + var metavars; + + var buildMetavar = this._metavarFormatter(action, metavarDefault); + + switch (action.nargs) { + /*eslint-disable no-undefined*/ + case undefined: + case null: + metavars = buildMetavar(1); + result = '' + metavars[0]; + break; + case c.OPTIONAL: + metavars = buildMetavar(1); + result = '[' + metavars[0] + ']'; + break; + case c.ZERO_OR_MORE: + metavars = buildMetavar(2); + result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]'; + break; + case c.ONE_OR_MORE: + metavars = buildMetavar(2); + result = '' + metavars[0] + ' [' + metavars[1] + ' ...]'; + break; + case c.REMAINDER: + result = '...'; + break; + case c.PARSER: + metavars = buildMetavar(1); + result = metavars[0] + ' ...'; + break; + default: + metavars = buildMetavar(action.nargs); + result = metavars.join(' '); + } + return result; +}; + +HelpFormatter.prototype._expandHelp = function (action) { + var params = { prog: this._prog }; + + Object.keys(action).forEach(function (actionProperty) { + var actionValue = action[actionProperty]; + + if (actionValue !== c.SUPPRESS) { + params[actionProperty] = actionValue; + } + }); + + if (params.choices) { + if (typeof params.choices === 'string') { + params.choices = params.choices.split('').join(', '); + } else if (Array.isArray(params.choices)) { + params.choices = params.choices.join(', '); + } else { + params.choices = Object.keys(params.choices).join(', '); + } + } + + return sprintf(this._getHelpString(action), params); +}; + +HelpFormatter.prototype._splitLines = function (text, width) { + var lines = []; + var delimiters = [ ' ', '.', ',', '!', '?' ]; + var re = new RegExp('[' + delimiters.join('') + '][^' + delimiters.join('') + ']*$'); + + text = text.replace(/[\n\|\t]/g, ' '); + + text = text.trim(); + text = text.replace(this._whitespaceMatcher, ' '); + + // Wraps the single paragraph in text (a string) so every line + // is at most width characters long. + text.split(c.EOL).forEach(function (line) { + if (width >= line.length) { + lines.push(line); + return; + } + + var wrapStart = 0; + var wrapEnd = width; + var delimiterIndex = 0; + while (wrapEnd <= line.length) { + if (wrapEnd !== line.length && delimiters.indexOf(line[wrapEnd] < -1)) { + delimiterIndex = (re.exec(line.substring(wrapStart, wrapEnd)) || {}).index; + wrapEnd = wrapStart + delimiterIndex + 1; + } + lines.push(line.substring(wrapStart, wrapEnd)); + wrapStart = wrapEnd; + wrapEnd += width; + } + if (wrapStart < line.length) { + lines.push(line.substring(wrapStart, wrapEnd)); + } + }); + + return lines; +}; + +HelpFormatter.prototype._fillText = function (text, width, indent) { + var lines = this._splitLines(text, width); + lines = lines.map(function (line) { + return indent + line; + }); + return lines.join(c.EOL); +}; + +HelpFormatter.prototype._getHelpString = function (action) { + return action.help; +}; diff --git a/node_modules/argparse/lib/namespace.js b/node_modules/argparse/lib/namespace.js new file mode 100644 index 00000000..a860de9e --- /dev/null +++ b/node_modules/argparse/lib/namespace.js @@ -0,0 +1,76 @@ +/** + * class Namespace + * + * Simple object for storing attributes. Implements equality by attribute names + * and values, and provides a simple string representation. + * + * See also [original guide][1] + * + * [1]:http://docs.python.org/dev/library/argparse.html#the-namespace-object + **/ +'use strict'; + +var $$ = require('./utils'); + +/** + * new Namespace(options) + * - options(object): predefined propertis for result object + * + **/ +var Namespace = module.exports = function Namespace(options) { + $$.extend(this, options); +}; + +/** + * Namespace#isset(key) -> Boolean + * - key (string|number): property name + * + * Tells whenever `namespace` contains given `key` or not. + **/ +Namespace.prototype.isset = function (key) { + return $$.has(this, key); +}; + +/** + * Namespace#set(key, value) -> self + * -key (string|number|object): propery name + * -value (mixed): new property value + * + * Set the property named key with value. + * If key object then set all key properties to namespace object + **/ +Namespace.prototype.set = function (key, value) { + if (typeof (key) === 'object') { + $$.extend(this, key); + } else { + this[key] = value; + } + return this; +}; + +/** + * Namespace#get(key, defaultValue) -> mixed + * - key (string|number): property name + * - defaultValue (mixed): default value + * + * Return the property key or defaulValue if not set + **/ +Namespace.prototype.get = function (key, defaultValue) { + return !this[key] ? defaultValue : this[key]; +}; + +/** + * Namespace#unset(key, defaultValue) -> mixed + * - key (string|number): property name + * - defaultValue (mixed): default value + * + * Return data[key](and delete it) or defaultValue + **/ +Namespace.prototype.unset = function (key, defaultValue) { + var value = this[key]; + if (value !== null) { + delete this[key]; + return value; + } + return defaultValue; +}; diff --git a/node_modules/argparse/lib/utils.js b/node_modules/argparse/lib/utils.js new file mode 100644 index 00000000..4a9cf3ed --- /dev/null +++ b/node_modules/argparse/lib/utils.js @@ -0,0 +1,57 @@ +'use strict'; + +exports.repeat = function (str, num) { + var result = ''; + for (var i = 0; i < num; i++) { result += str; } + return result; +}; + +exports.arrayEqual = function (a, b) { + if (a.length !== b.length) { return false; } + for (var i = 0; i < a.length; i++) { + if (a[i] !== b[i]) { return false; } + } + return true; +}; + +exports.trimChars = function (str, chars) { + var start = 0; + var end = str.length - 1; + while (chars.indexOf(str.charAt(start)) >= 0) { start++; } + while (chars.indexOf(str.charAt(end)) >= 0) { end--; } + return str.slice(start, end + 1); +}; + +exports.capitalize = function (str) { + return str.charAt(0).toUpperCase() + str.slice(1); +}; + +exports.arrayUnion = function () { + var result = []; + for (var i = 0, values = {}; i < arguments.length; i++) { + var arr = arguments[i]; + for (var j = 0; j < arr.length; j++) { + if (!values[arr[j]]) { + values[arr[j]] = true; + result.push(arr[j]); + } + } + } + return result; +}; + +function has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +exports.has = has; + +exports.extend = function (dest, src) { + for (var i in src) { + if (has(src, i)) { dest[i] = src[i]; } + } +}; + +exports.trimEnd = function (str) { + return str.replace(/\s+$/g, ''); +}; diff --git a/node_modules/argparse/package.json b/node_modules/argparse/package.json new file mode 100644 index 00000000..47f407be --- /dev/null +++ b/node_modules/argparse/package.json @@ -0,0 +1,70 @@ +{ + "_from": "argparse@^1.0.7", + "_id": "argparse@1.0.10", + "_inBundle": false, + "_integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "_location": "/argparse", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "argparse@^1.0.7", + "name": "argparse", + "escapedName": "argparse", + "rawSpec": "^1.0.7", + "saveSpec": null, + "fetchSpec": "^1.0.7" + }, + "_requiredBy": [ + "/js-yaml" + ], + "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "_shasum": "bcd6791ea5ae09725e17e5ad988134cd40b3d911", + "_spec": "argparse@^1.0.7", + "_where": "/home/remi/github/CPP_BIDS/node_modules/js-yaml", + "bugs": { + "url": "https://github.com/nodeca/argparse/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Eugene Shkuropat" + }, + { + "name": "Paul Jacobson" + } + ], + "dependencies": { + "sprintf-js": "~1.0.2" + }, + "deprecated": false, + "description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library", + "devDependencies": { + "eslint": "^2.13.1", + "istanbul": "^0.4.5", + "mocha": "^3.1.0", + "ndoc": "^5.0.1" + }, + "files": [ + "index.js", + "lib/" + ], + "homepage": "https://github.com/nodeca/argparse#readme", + "keywords": [ + "cli", + "parser", + "argparse", + "option", + "args" + ], + "license": "MIT", + "name": "argparse", + "repository": { + "type": "git", + "url": "git+https://github.com/nodeca/argparse.git" + }, + "scripts": { + "test": "make test" + }, + "version": "1.0.10" +} diff --git a/node_modules/arr-diff/LICENSE b/node_modules/arr-diff/LICENSE new file mode 100755 index 00000000..fa30c4cb --- /dev/null +++ b/node_modules/arr-diff/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/arr-diff/README.md b/node_modules/arr-diff/README.md new file mode 100644 index 00000000..7705c6cd --- /dev/null +++ b/node_modules/arr-diff/README.md @@ -0,0 +1,74 @@ +# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg)](https://www.npmjs.com/package/arr-diff) [![Build Status](https://img.shields.io/travis/jonschlinkert/base.svg)](https://travis-ci.org/jonschlinkert/base) + +> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i arr-diff --save +``` +Install with [bower](http://bower.io/) + +```sh +$ bower install arr-diff --save +``` + +## API + +### [diff](index.js#L33) + +Return the difference between the first array and additional arrays. + +**Params** + +* `a` **{Array}** +* `b` **{Array}** +* `returns` **{Array}** + +**Example** + +```js +var diff = require('arr-diff'); + +var a = ['a', 'b', 'c', 'd']; +var b = ['b', 'c']; + +console.log(diff(a, b)) +//=> ['a', 'd'] +``` + +## Related projects + +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten) +* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter) +* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://www.npmjs.com/package/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection) + +## 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/arr-diff/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 Sat Dec 05 2015 23:24:53 GMT-0500 (EST)._ diff --git a/node_modules/arr-diff/index.js b/node_modules/arr-diff/index.js new file mode 100644 index 00000000..bc7200d8 --- /dev/null +++ b/node_modules/arr-diff/index.js @@ -0,0 +1,58 @@ +/*! + * arr-diff + * + * Copyright (c) 2014 Jon Schlinkert, contributors. + * Licensed under the MIT License + */ + +'use strict'; + +var flatten = require('arr-flatten'); +var slice = [].slice; + +/** + * Return the difference between the first array and + * additional arrays. + * + * ```js + * var diff = require('{%= name %}'); + * + * var a = ['a', 'b', 'c', 'd']; + * var b = ['b', 'c']; + * + * console.log(diff(a, b)) + * //=> ['a', 'd'] + * ``` + * + * @param {Array} `a` + * @param {Array} `b` + * @return {Array} + * @api public + */ + +function diff(arr, arrays) { + var argsLen = arguments.length; + var len = arr.length, i = -1; + var res = [], arrays; + + if (argsLen === 1) { + return arr; + } + + if (argsLen > 2) { + arrays = flatten(slice.call(arguments, 1)); + } + + while (++i < len) { + if (!~arrays.indexOf(arr[i])) { + res.push(arr[i]); + } + } + return res; +} + +/** + * Expose `diff` + */ + +module.exports = diff; diff --git a/node_modules/arr-diff/package.json b/node_modules/arr-diff/package.json new file mode 100644 index 00000000..bd2320c5 --- /dev/null +++ b/node_modules/arr-diff/package.json @@ -0,0 +1,80 @@ +{ + "_from": "arr-diff@^2.0.0", + "_id": "arr-diff@2.0.0", + "_inBundle": false, + "_integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "_location": "/arr-diff", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "arr-diff@^2.0.0", + "name": "arr-diff", + "escapedName": "arr-diff", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/micromatch" + ], + "_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "_shasum": "8f3b827f955a8bd669697e4a4256ac3ceae356cf", + "_spec": "arr-diff@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/arr-diff/issues" + }, + "bundleDependencies": false, + "dependencies": { + "arr-flatten": "^1.0.1" + }, + "deprecated": false, + "description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.", + "devDependencies": { + "array-differ": "^1.0.0", + "array-slice": "^0.2.3", + "benchmarked": "^0.1.4", + "chalk": "^1.1.1", + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/arr-diff", + "keywords": [ + "arr", + "array", + "diff", + "differ", + "difference" + ], + "license": "MIT", + "main": "index.js", + "name": "arr-diff", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/arr-diff.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "arr-flatten", + "array-filter", + "array-intersection" + ] + } + }, + "version": "2.0.0" +} diff --git a/node_modules/arr-flatten/LICENSE b/node_modules/arr-flatten/LICENSE new file mode 100755 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/arr-flatten/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/arr-flatten/README.md b/node_modules/arr-flatten/README.md new file mode 100755 index 00000000..7dc7a974 --- /dev/null +++ b/node_modules/arr-flatten/README.md @@ -0,0 +1,86 @@ +# arr-flatten [![NPM version](https://img.shields.io/npm/v/arr-flatten.svg?style=flat)](https://www.npmjs.com/package/arr-flatten) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![NPM total downloads](https://img.shields.io/npm/dt/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-flatten.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-flatten) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/arr-flatten.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/arr-flatten) + +> Recursively flatten an array or arrays. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save arr-flatten +``` + +## Install + +Install with [bower](https://bower.io/) + +```sh +$ bower install arr-flatten --save +``` + +## Usage + +```js +var flatten = require('arr-flatten'); + +flatten(['a', ['b', ['c']], 'd', ['e']]); +//=> ['a', 'b', 'c', 'd', 'e'] +``` + +## Why another flatten utility? + +I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%. + +## About + +### Related projects + +* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.") +* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.") +* [array-each](https://www.npmjs.com/package/array-each): Loop over each item in an array and call the given function on every element. | [homepage](https://github.com/jonschlinkert/array-each "Loop over each item in an array and call the given function on every element.") +* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 20 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [lukeed](https://github.com/lukeed) | + +### 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 05, 2017._ \ No newline at end of file diff --git a/node_modules/arr-flatten/index.js b/node_modules/arr-flatten/index.js new file mode 100644 index 00000000..0cb4ea4e --- /dev/null +++ b/node_modules/arr-flatten/index.js @@ -0,0 +1,22 @@ +/*! + * arr-flatten + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function (arr) { + return flat(arr, []); +}; + +function flat(arr, res) { + var i = 0, cur; + var len = arr.length; + for (; i < len; i++) { + cur = arr[i]; + Array.isArray(cur) ? flat(cur, res) : res.push(cur); + } + return res; +} diff --git a/node_modules/arr-flatten/package.json b/node_modules/arr-flatten/package.json new file mode 100644 index 00000000..2eaa218d --- /dev/null +++ b/node_modules/arr-flatten/package.json @@ -0,0 +1,114 @@ +{ + "_from": "arr-flatten@^1.0.1", + "_id": "arr-flatten@1.1.0", + "_inBundle": false, + "_integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "_location": "/arr-flatten", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "arr-flatten@^1.0.1", + "name": "arr-flatten", + "escapedName": "arr-flatten", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/arr-diff", + "/readdirp/braces" + ], + "_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "_shasum": "36048bbff4e7b47e136644316c99669ea5ae91f1", + "_spec": "arr-flatten@^1.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/arr-diff", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/arr-flatten/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Luke Edwards", + "url": "https://lukeed.com" + } + ], + "deprecated": false, + "description": "Recursively flatten an array or arrays.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "array-flatten": "^2.1.1", + "array-slice": "^1.0.0", + "benchmarked": "^1.0.0", + "compute-flatten": "^1.0.0", + "flatit": "^1.1.1", + "flatten": "^1.0.2", + "flatten-array": "^1.0.0", + "glob": "^7.1.1", + "gulp-format-md": "^0.1.12", + "just-flatten-it": "^1.1.23", + "lodash.flattendeep": "^4.4.0", + "m_flattened": "^1.0.1", + "mocha": "^3.2.0", + "utils-flatten": "^1.0.0", + "write": "^0.3.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/arr-flatten", + "keywords": [ + "arr", + "array", + "elements", + "flat", + "flatten", + "nested", + "recurse", + "recursive", + "recursively" + ], + "license": "MIT", + "main": "index.js", + "name": "arr-flatten", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/arr-flatten.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-filter", + "arr-union", + "array-each", + "array-unique" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "1.1.0" +} diff --git a/node_modules/arr-union/LICENSE b/node_modules/arr-union/LICENSE new file mode 100644 index 00000000..39245ac1 --- /dev/null +++ b/node_modules/arr-union/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/arr-union/README.md b/node_modules/arr-union/README.md new file mode 100644 index 00000000..b3cd4f48 --- /dev/null +++ b/node_modules/arr-union/README.md @@ -0,0 +1,99 @@ +# arr-union [![NPM version](https://img.shields.io/npm/v/arr-union.svg)](https://www.npmjs.com/package/arr-union) [![Build Status](https://img.shields.io/travis/jonschlinkert/arr-union.svg)](https://travis-ci.org/jonschlinkert/arr-union) + +> Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm i arr-union --save +``` + +## Benchmarks + +This library is **10-20 times faster** and more performant than [array-union](https://github.com/sindresorhus/array-union). + +See the [benchmarks](./benchmark). + +```sh +#1: five-arrays + array-union x 511,121 ops/sec ±0.80% (96 runs sampled) + arr-union x 5,716,039 ops/sec ±0.86% (93 runs sampled) + +#2: ten-arrays + array-union x 245,196 ops/sec ±0.69% (94 runs sampled) + arr-union x 1,850,786 ops/sec ±0.84% (97 runs sampled) + +#3: two-arrays + array-union x 563,869 ops/sec ±0.97% (94 runs sampled) + arr-union x 9,602,852 ops/sec ±0.87% (92 runs sampled) +``` + +## Usage + +```js +var union = require('arr-union'); + +union(['a'], ['b', 'c'], ['d', 'e', 'f']); +//=> ['a', 'b', 'c', 'd', 'e', 'f'] +``` + +Returns only unique elements: + +```js +union(['a', 'a'], ['b', 'c']); +//=> ['a', 'b', 'c'] +``` + +## Related projects + +* [arr-diff](https://www.npmjs.com/package/arr-diff): Returns an array with only the unique values from the first array, by excluding all… [more](https://www.npmjs.com/package/arr-diff) | [homepage](https://github.com/jonschlinkert/arr-diff) +* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter) +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten) +* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map) +* [arr-pluck](https://www.npmjs.com/package/arr-pluck): Retrieves the value of a specified property from all elements in the collection. | [homepage](https://github.com/jonschlinkert/arr-pluck) +* [arr-reduce](https://www.npmjs.com/package/arr-reduce): Fast array reduce that also loops over sparse elements. | [homepage](https://github.com/jonschlinkert/arr-reduce) +* [array-unique](https://www.npmjs.com/package/array-unique): Return an array free of duplicate values. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-union/issues/new). + +## Building docs + +Generate readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm i verb && npm run docs +``` + +Or, if [verb](https://github.com/verbose/verb) is installed globally: + +```sh +$ verb +``` + +## 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 © 2016 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the [MIT license](https://github.com/jonschlinkert/arr-union/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 23, 2016._ \ No newline at end of file diff --git a/node_modules/arr-union/index.js b/node_modules/arr-union/index.js new file mode 100644 index 00000000..5ae6c4a0 --- /dev/null +++ b/node_modules/arr-union/index.js @@ -0,0 +1,29 @@ +'use strict'; + +module.exports = function union(init) { + if (!Array.isArray(init)) { + throw new TypeError('arr-union expects the first argument to be an array.'); + } + + var len = arguments.length; + var i = 0; + + while (++i < len) { + var arg = arguments[i]; + if (!arg) continue; + + if (!Array.isArray(arg)) { + arg = [arg]; + } + + for (var j = 0; j < arg.length; j++) { + var ele = arg[j]; + + if (init.indexOf(ele) >= 0) { + continue; + } + init.push(ele); + } + } + return init; +}; diff --git a/node_modules/arr-union/package.json b/node_modules/arr-union/package.json new file mode 100644 index 00000000..e69cf7a0 --- /dev/null +++ b/node_modules/arr-union/package.json @@ -0,0 +1,108 @@ +{ + "_from": "arr-union@^3.1.0", + "_id": "arr-union@3.1.0", + "_inBundle": false, + "_integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "_location": "/arr-union", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "arr-union@^3.1.0", + "name": "arr-union", + "escapedName": "arr-union", + "rawSpec": "^3.1.0", + "saveSpec": null, + "fetchSpec": "^3.1.0" + }, + "_requiredBy": [ + "/class-utils", + "/union-value" + ], + "_resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "_shasum": "e39b09aea9def866a8f206e288af63919bae39c4", + "_spec": "arr-union@^3.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/union-value", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/arr-union/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "array-union": "^1.0.1", + "array-unique": "^0.2.1", + "benchmarked": "^0.1.4", + "gulp-format-md": "^0.1.7", + "minimist": "^1.1.1", + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/arr-union", + "keywords": [ + "add", + "append", + "array", + "arrays", + "combine", + "concat", + "extend", + "union", + "uniq", + "unique", + "util", + "utility", + "utils" + ], + "license": "MIT", + "main": "index.js", + "name": "arr-union", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/arr-union.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-diff", + "arr-flatten", + "arr-filter", + "arr-map", + "arr-pluck", + "arr-reduce", + "array-unique" + ] + }, + "reflinks": [ + "verb", + "array-union" + ], + "lint": { + "reflinks": true + } + }, + "version": "3.1.0" +} diff --git a/node_modules/array-unique/LICENSE b/node_modules/array-unique/LICENSE new file mode 100755 index 00000000..fa30c4cb --- /dev/null +++ b/node_modules/array-unique/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/array-unique/README.md b/node_modules/array-unique/README.md new file mode 100755 index 00000000..2e287743 --- /dev/null +++ b/node_modules/array-unique/README.md @@ -0,0 +1,51 @@ +# array-unique [![NPM version](https://badge.fury.io/js/array-unique.svg)](http://badge.fury.io/js/array-unique) [![Build Status](https://travis-ci.org/jonschlinkert/array-unique.svg)](https://travis-ci.org/jonschlinkert/array-unique) + +> Return an array free of duplicate values. Fastest ES5 implementation. + +## Install with [npm](npmjs.org) + +```bash +npm i array-unique --save +``` + +## Usage + +```js +var unique = require('array-unique'); + +unique(['a', 'b', 'c', 'c']); +//=> ['a', 'b', 'c'] +``` + +## Related +* [arr-diff](https://github.com/jonschlinkert/arr-diff): Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons. +* [arr-union](https://github.com/jonschlinkert/arr-union): Returns an array of unique values using strict equality for comparisons. +* [arr-flatten](https://github.com/jonschlinkert/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. +* [arr-reduce](https://github.com/jonschlinkert/arr-reduce): Fast array reduce that also loops over sparse elements. +* [arr-map](https://github.com/jonschlinkert/arr-map): Faster, node.js focused alternative to JavaScript's native array map. +* [arr-pluck](https://github.com/jonschlinkert/arr-pluck): Retrieves the value of a specified property from all elements in the collection. + +## Run 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/array-unique/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 March 24, 2015._ \ No newline at end of file diff --git a/node_modules/array-unique/index.js b/node_modules/array-unique/index.js new file mode 100755 index 00000000..7fa75af9 --- /dev/null +++ b/node_modules/array-unique/index.js @@ -0,0 +1,28 @@ +/*! + * array-unique + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +module.exports = function unique(arr) { + if (!Array.isArray(arr)) { + throw new TypeError('array-unique expects an array.'); + } + + var len = arr.length; + var i = -1; + + while (i++ < len) { + var j = i + 1; + + for (; j < arr.length; ++j) { + if (arr[i] === arr[j]) { + arr.splice(j--, 1); + } + } + } + return arr; +}; diff --git a/node_modules/array-unique/package.json b/node_modules/array-unique/package.json new file mode 100755 index 00000000..6b758442 --- /dev/null +++ b/node_modules/array-unique/package.json @@ -0,0 +1,62 @@ +{ + "_from": "array-unique@^0.2.1", + "_id": "array-unique@0.2.1", + "_inBundle": false, + "_integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "_location": "/array-unique", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "array-unique@^0.2.1", + "name": "array-unique", + "escapedName": "array-unique", + "rawSpec": "^0.2.1", + "saveSpec": null, + "fetchSpec": "^0.2.1" + }, + "_requiredBy": [ + "/micromatch" + ], + "_resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "_shasum": "a1d97ccafcbc2625cc70fadceb36a50c58b01a53", + "_spec": "array-unique@^0.2.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/array-unique/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Return an array free of duplicate values. Fastest ES5 implementation.", + "devDependencies": { + "array-uniq": "^1.0.2", + "benchmarked": "^0.1.3", + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/array-unique", + "license": { + "type": "MIT", + "url": "https://github.com/jonschlinkert/array-unique/blob/master/LICENSE" + }, + "main": "index.js", + "name": "array-unique", + "repository": { + "type": "git", + "url": "git://github.com/jonschlinkert/array-unique.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "0.2.1" +} diff --git a/node_modules/assign-symbols/LICENSE b/node_modules/assign-symbols/LICENSE new file mode 100644 index 00000000..65f90aca --- /dev/null +++ b/node_modules/assign-symbols/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/assign-symbols/README.md b/node_modules/assign-symbols/README.md new file mode 100644 index 00000000..422729d4 --- /dev/null +++ b/node_modules/assign-symbols/README.md @@ -0,0 +1,73 @@ +# assign-symbols [![NPM version](https://badge.fury.io/js/assign-symbols.svg)](http://badge.fury.io/js/assign-symbols) + +> Assign the enumerable es6 Symbol properties from an object (or objects) to the first object passed on the arguments. Can be used as a supplement to other extend, assign or merge methods as a polyfill for the Symbols part of the es6 Object.assign method. + +From the [Mozilla Developer docs for Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol): + +> A symbol is a unique and immutable data type and may be used as an identifier for object properties. The symbol object is an implicit object wrapper for the symbol primitive data type. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i assign-symbols --save +``` + +## Usage + +```js +var assignSymbols = require('assign-symbols'); +var obj = {}; + +var one = {}; +var symbolOne = Symbol('aaa'); +one[symbolOne] = 'bbb'; + +var two = {}; +var symbolTwo = Symbol('ccc'); +two[symbolTwo] = 'ddd'; + +assignSymbols(obj, one, two); + +console.log(obj[symbolOne]); +//=> 'bbb' +console.log(obj[symbolTwo]); +//=> 'ddd' +``` + +## Similar projects + +* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. | [homepage](https://github.com/jonschlinkert/assign-deep) +* [clone-deep](https://www.npmjs.com/package/clone-deep): Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives. | [homepage](https://github.com/jonschlinkert/clone-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) +* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep) +* [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) + +## 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/assign-symbols/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 November 06, 2015._ \ No newline at end of file diff --git a/node_modules/assign-symbols/index.js b/node_modules/assign-symbols/index.js new file mode 100644 index 00000000..c08a232b --- /dev/null +++ b/node_modules/assign-symbols/index.js @@ -0,0 +1,40 @@ +/*! + * assign-symbols + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +module.exports = function(receiver, objects) { + if (receiver === null || typeof receiver === 'undefined') { + throw new TypeError('expected first argument to be an object.'); + } + + if (typeof objects === 'undefined' || typeof Symbol === 'undefined') { + return receiver; + } + + if (typeof Object.getOwnPropertySymbols !== 'function') { + return receiver; + } + + var isEnumerable = Object.prototype.propertyIsEnumerable; + var target = Object(receiver); + var len = arguments.length, i = 0; + + while (++i < len) { + var provider = Object(arguments[i]); + var names = Object.getOwnPropertySymbols(provider); + + for (var j = 0; j < names.length; j++) { + var key = names[j]; + + if (isEnumerable.call(provider, key)) { + target[key] = provider[key]; + } + } + } + return target; +}; diff --git a/node_modules/assign-symbols/package.json b/node_modules/assign-symbols/package.json new file mode 100644 index 00000000..85e906c2 --- /dev/null +++ b/node_modules/assign-symbols/package.json @@ -0,0 +1,71 @@ +{ + "_from": "assign-symbols@^1.0.0", + "_id": "assign-symbols@1.0.0", + "_inBundle": false, + "_integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "_location": "/assign-symbols", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "assign-symbols@^1.0.0", + "name": "assign-symbols", + "escapedName": "assign-symbols", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/extend-shallow" + ], + "_resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "_shasum": "59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367", + "_spec": "assign-symbols@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/extend-shallow", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/assign-symbols/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Assign the enumerable es6 Symbol properties from an object (or objects) to the first object passed on the arguments. Can be used as a supplement to other extend, assign or merge methods as a polyfill for the Symbols part of the es6 Object.assign method.", + "devDependencies": { + "mocha": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/assign-symbols", + "keywords": [ + "assign", + "symbols" + ], + "license": "MIT", + "main": "index.js", + "name": "assign-symbols", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/assign-symbols.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "assign-deep", + "mixin-deep", + "merge-deep", + "extend-shallow", + "clone-deep" + ] + } + }, + "version": "1.0.0" +} diff --git a/node_modules/async-each/README.md b/node_modules/async-each/README.md new file mode 100644 index 00000000..6444d954 --- /dev/null +++ b/node_modules/async-each/README.md @@ -0,0 +1,52 @@ +# async-each + +No-bullshit, ultra-simple, 35-lines-of-code async parallel forEach function for JavaScript. + +We don't need junky 30K async libs. Really. + +For browsers and node.js. + +## Installation +* Just include async-each before your scripts. +* `npm install async-each` if you’re using node.js. + +## Usage + +* `each(array, iterator, callback);` — `Array`, `Function`, `(optional) Function` +* `iterator(item, next)` receives current item and a callback that will mark the item as done. `next` callback receives optional `error, transformedItem` arguments. +* `callback(error, transformedArray)` optionally receives first error and transformed result `Array`. + +```javascript +var each = require('async-each'); +each(['a.js', 'b.js', 'c.js'], fs.readFile, function(error, contents) { + if (error) console.error(error); + console.log('Contents for a, b and c:', contents); +}); + +// Alternatively in browser: +asyncEach(list, fn, callback); +``` + +## License + +The MIT License (MIT) + +Copyright (c) 2016 Paul Miller [(paulmillr.com)](http://paulmillr.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/async-each/index.js b/node_modules/async-each/index.js new file mode 100644 index 00000000..277217df --- /dev/null +++ b/node_modules/async-each/index.js @@ -0,0 +1,38 @@ +// async-each MIT license (by Paul Miller from https://paulmillr.com). +(function(globals) { + 'use strict'; + var each = function(items, next, callback) { + if (!Array.isArray(items)) throw new TypeError('each() expects array as first argument'); + if (typeof next !== 'function') throw new TypeError('each() expects function as second argument'); + if (typeof callback !== 'function') callback = Function.prototype; // no-op + + if (items.length === 0) return callback(undefined, items); + + var transformed = new Array(items.length); + var count = 0; + var returned = false; + + items.forEach(function(item, index) { + next(item, function(error, transformedItem) { + if (returned) return; + if (error) { + returned = true; + return callback(error); + } + transformed[index] = transformedItem; + count += 1; + if (count === items.length) return callback(undefined, transformed); + }); + }); + }; + + if (typeof define !== 'undefined' && define.amd) { + define([], function() { + return each; + }); // RequireJS + } else if (typeof module !== 'undefined' && module.exports) { + module.exports = each; // CommonJS + } else { + globals.asyncEach = each; // + + +``` + +Browser support was done mostly for the online demo. If you find any errors - feel +free to send pull requests with fixes. Also note, that IE and other old browsers +needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate. + +Notes: + +1. We have no resources to support browserified version. Don't expect it to be + well tested. Don't expect fast fixes if something goes wrong there. +2. `!!js/function` in browser bundle will not work by default. If you really need + it - load `esprima` parser first (via amd or directly). +3. `!!bin` in browser will return `Array`, because browsers do not support + node.js `Buffer` and adding Buffer shims is completely useless on practice. + + +API +--- + +Here we cover the most 'useful' methods. If you need advanced details (creating +your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and +[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more +info. + +``` javascript +const yaml = require('js-yaml'); +const fs = require('fs'); + +// Get document, or throw exception on error +try { + const doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8')); + console.log(doc); +} catch (e) { + console.log(e); +} +``` + + +### safeLoad (string [ , options ]) + +**Recommended loading way.** Parses `string` as single YAML document. Returns either a +plain object, a string or `undefined`, or throws `YAMLException` on error. By default, does +not support regexps, functions and undefined. This method is safe for untrusted data. + +options: + +- `filename` _(default: null)_ - string to be used as a file path in + error/warning messages. +- `onWarning` _(default: null)_ - function to call on warning messages. + Loader will call this function with an instance of `YAMLException` for each warning. +- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use. + - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects: + http://www.yaml.org/spec/1.2/spec.html#id2802346 + - `JSON_SCHEMA` - all JSON-supported types: + http://www.yaml.org/spec/1.2/spec.html#id2803231 + - `CORE_SCHEMA` - same as `JSON_SCHEMA`: + http://www.yaml.org/spec/1.2/spec.html#id2804923 + - `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones + (`!!js/undefined`, `!!js/regexp` and `!!js/function`): + http://yaml.org/type/ + - `DEFAULT_FULL_SCHEMA` - all supported YAML types. +- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error. + +NOTE: This function **does not** understand multi-document sources, it throws +exception on those. + +NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions. +So, the JSON schema is not as strictly defined in the YAML specification. +It allows numbers in any notation, use `Null` and `NULL` as `null`, etc. +The core schema also has no such restrictions. It allows binary notation for integers. + + +### load (string [ , options ]) + +**Use with care with untrusted sources**. The same as `safeLoad()` but uses +`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types: +`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources, you +must additionally validate object structure to avoid injections: + +``` javascript +const untrusted_code = '"toString": ! "function (){very_evil_thing();}"'; + +// I'm just converting that string, what could possibly go wrong? +require('js-yaml').load(untrusted_code) + '' +``` + + +### safeLoadAll (string [, iterator] [, options ]) + +Same as `safeLoad()`, but understands multi-document sources. Applies +`iterator` to each document if specified, or returns array of documents. + +``` javascript +const yaml = require('js-yaml'); + +yaml.safeLoadAll(data, function (doc) { + console.log(doc); +}); +``` + + +### loadAll (string [, iterator] [ , options ]) + +Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default. + + +### safeDump (object [ , options ]) + +Serializes `object` as a YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will +throw an exception if you try to dump regexps or functions. However, you can +disable exceptions by setting the `skipInvalid` option to `true`. + +options: + +- `indent` _(default: 2)_ - indentation width to use (in spaces). +- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements +- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function + in the safe schema) and skip pairs and single values with such types. +- `flowLevel` (default: -1) - specifies level of nesting, when to switch from + block to flow style for collections. -1 means block style everwhere +- `styles` - "tag" => "style" map. Each tag may have own set of styles. +- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use. +- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a + function, use the function to sort the keys. +- `lineWidth` _(default: `80`)_ - set max line width. +- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references +- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older + yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 +- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded. + +The following table show availlable styles (e.g. "canonical", +"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml +output is shown on the right side after `=>` (default setting) or `->`: + +``` none +!!null + "canonical" -> "~" + "lowercase" => "null" + "uppercase" -> "NULL" + "camelcase" -> "Null" + +!!int + "binary" -> "0b1", "0b101010", "0b1110001111010" + "octal" -> "01", "052", "016172" + "decimal" => "1", "42", "7290" + "hexadecimal" -> "0x1", "0x2A", "0x1C7A" + +!!bool + "lowercase" => "true", "false" + "uppercase" -> "TRUE", "FALSE" + "camelcase" -> "True", "False" + +!!float + "lowercase" => ".nan", '.inf' + "uppercase" -> ".NAN", '.INF' + "camelcase" -> ".NaN", '.Inf' +``` + +Example: + +``` javascript +safeDump (object, { + 'styles': { + '!!null': 'canonical' // dump null as ~ + }, + 'sortKeys': true // sort object keys +}); +``` + +### dump (object [ , options ]) + +Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default). + + +Supported YAML types +-------------------- + +The list of standard YAML tags and corresponding JavaScipt types. See also +[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and +[YAML types repository](http://yaml.org/type/). + +``` +!!null '' # null +!!bool 'yes' # bool +!!int '3...' # number +!!float '3.14...' # number +!!binary '...base64...' # buffer +!!timestamp 'YYYY-...' # date +!!omap [ ... ] # array of key-value pairs +!!pairs [ ... ] # array or array pairs +!!set { ... } # array of objects with given keys and null values +!!str '...' # string +!!seq [ ... ] # array +!!map { ... } # object +``` + +**JavaScript-specific tags** + +``` +!!js/regexp /pattern/gim # RegExp +!!js/undefined '' # Undefined +!!js/function 'function () {...}' # Function +``` + +Caveats +------- + +Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects +or arrays as keys, and stringifies (by calling `toString()` method) them at the +moment of adding them. + +``` yaml +--- +? [ foo, bar ] +: - baz +? { foo: bar } +: - baz + - baz +``` + +``` javascript +{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] } +``` + +Also, reading of properties on implicit block mapping keys is not supported yet. +So, the following YAML document cannot be loaded. + +``` yaml +&anchor foo: + foo: bar + *anchor: duplicate key + baz: bat + *anchor: duplicate key +``` + + +js-yaml for enterprise +---------------------- + +Available as part of the Tidelift Subscription + +The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/js-yaml/bin/js-yaml.js b/node_modules/js-yaml/bin/js-yaml.js new file mode 100755 index 00000000..e79186be --- /dev/null +++ b/node_modules/js-yaml/bin/js-yaml.js @@ -0,0 +1,132 @@ +#!/usr/bin/env node + + +'use strict'; + +/*eslint-disable no-console*/ + + +// stdlib +var fs = require('fs'); + + +// 3rd-party +var argparse = require('argparse'); + + +// internal +var yaml = require('..'); + + +//////////////////////////////////////////////////////////////////////////////// + + +var cli = new argparse.ArgumentParser({ + prog: 'js-yaml', + version: require('../package.json').version, + addHelp: true +}); + + +cli.addArgument([ '-c', '--compact' ], { + help: 'Display errors in compact mode', + action: 'storeTrue' +}); + + +// deprecated (not needed after we removed output colors) +// option suppressed, but not completely removed for compatibility +cli.addArgument([ '-j', '--to-json' ], { + help: argparse.Const.SUPPRESS, + dest: 'json', + action: 'storeTrue' +}); + + +cli.addArgument([ '-t', '--trace' ], { + help: 'Show stack trace on error', + action: 'storeTrue' +}); + +cli.addArgument([ 'file' ], { + help: 'File to read, utf-8 encoded without BOM', + nargs: '?', + defaultValue: '-' +}); + + +//////////////////////////////////////////////////////////////////////////////// + + +var options = cli.parseArgs(); + + +//////////////////////////////////////////////////////////////////////////////// + +function readFile(filename, encoding, callback) { + if (options.file === '-') { + // read from stdin + + var chunks = []; + + process.stdin.on('data', function (chunk) { + chunks.push(chunk); + }); + + process.stdin.on('end', function () { + return callback(null, Buffer.concat(chunks).toString(encoding)); + }); + } else { + fs.readFile(filename, encoding, callback); + } +} + +readFile(options.file, 'utf8', function (error, input) { + var output, isYaml; + + if (error) { + if (error.code === 'ENOENT') { + console.error('File not found: ' + options.file); + process.exit(2); + } + + console.error( + options.trace && error.stack || + error.message || + String(error)); + + process.exit(1); + } + + try { + output = JSON.parse(input); + isYaml = false; + } catch (err) { + if (err instanceof SyntaxError) { + try { + output = []; + yaml.loadAll(input, function (doc) { output.push(doc); }, {}); + isYaml = true; + + if (output.length === 0) output = null; + else if (output.length === 1) output = output[0]; + + } catch (e) { + if (options.trace && err.stack) console.error(e.stack); + else console.error(e.toString(options.compact)); + + process.exit(1); + } + } else { + console.error( + options.trace && err.stack || + err.message || + String(err)); + + process.exit(1); + } + } + + if (isYaml) console.log(JSON.stringify(output, null, ' ')); + else console.log(yaml.dump(output)); +}); diff --git a/node_modules/js-yaml/dist/js-yaml.js b/node_modules/js-yaml/dist/js-yaml.js new file mode 100644 index 00000000..d7287d47 --- /dev/null +++ b/node_modules/js-yaml/dist/js-yaml.js @@ -0,0 +1,3989 @@ +/* js-yaml 3.14.0 https://github.com/nodeca/js-yaml */(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.jsyaml = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + +function State(options) { + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// [24] b-line-feed ::= #xA /* LF */ +// [25] b-carriage-return ::= #xD /* CR */ +// [3] c-byte-order-mark ::= #xFEFF +function isNsChar(c) { + return isPrintable(c) && !isWhitespace(c) + // byte-order-mark + && c !== 0xFEFF + // b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// Simplified test for values allowed after the first character in plain style. +function isPlainSafe(c, prev) { + // Uses a subset of nb-char - c-flow-indicator - ":" - "#" + // where nb-char ::= c-printable - b-char - c-byte-order-mark. + return isPrintable(c) && c !== 0xFEFF + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // - ":" - "#" + // /* An ns-char preceding */ "#" + && c !== CHAR_COLON + && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + return isPrintable(c) && c !== 0xFEFF + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { + var i; + var char, prev_char; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(string.charCodeAt(0)) + && !isWhitespace(string.charCodeAt(string.length - 1)); + + if (singleLineOnly) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + return plain && !testAmbiguousType(string) + ? STYLE_PLAIN : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey) { + state.dump = (function () { + if (string.length === 0) { + return "''"; + } + if (!state.noCompatMode && + DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { + return "'" + string + "'"; + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char, nextChar; + var escapeSeq; + + for (var i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). + if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { + nextChar = string.charCodeAt(i + 1); + if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { + // Combine the surrogate pair and store it escaped. + result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); + // Advance index one extra since we already used that char here. + i++; continue; + } + } + escapeSeq = ESCAPE_SEQUENCES[char]; + result += !escapeSeq && isPrintable(char) + ? string[i] + : escapeSeq || encodeHex(char); + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || index !== 0) { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (index !== 0) pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || index !== 0) { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + state.tag = explicit ? type.tag : '?'; + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; + if (block && (state.dump.length !== 0)) { + writeBlockSequence(state, arrayLevel, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, arrayLevel, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey); + } + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + state.dump = '!<' + state.tag + '> ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; + + return ''; +} + +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + +module.exports.dump = dump; +module.exports.safeDump = safeDump; + +},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){ +// YAML error class. http://stackoverflow.com/questions/8458984 +// +'use strict'; + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } +} + + +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; + + +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; + + result += this.reason || '(unknown reason)'; + + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } + + return result; +}; + + +module.exports = YAMLException; + +},{}],5:[function(require,module,exports){ +'use strict'; + +/*eslint-disable max-len,no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Mark = require('./mark'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + _result[keyNode] = valueNode; + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = {}, + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _pos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + _pos = state.position; + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else { + break; // Reading is done. Go to the epilogue. + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if (state.lineIndent > nodeIndent && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!state.anchorMap.hasOwnProperty(alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag !== null && state.tag !== '!') { + if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +function safeLoadAll(input, iterator, options) { + if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; + +},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(require,module,exports){ +'use strict'; + + +var common = require('./common'); + + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} + + +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + + if (!this.buffer) return null; + + indent = indent || 4; + maxLength = maxLength || 75; + + head = ''; + start = this.position; + + while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } + + tail = ''; + end = this.position; + + while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } + } + + snippet = this.buffer.slice(start, end); + + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; + + +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; + + if (this.name) { + where += 'in "' + this.name + '" '; + } + + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; + } + } + + return where; +}; + + +module.exports = Mark; + +},{"./common":2}],7:[function(require,module,exports){ +'use strict'; + +/*eslint-disable max-len*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Type = require('./type'); + + +function compileList(schema, name, result) { + var exclude = []; + + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); + + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { + exclude.push(previousIndex); + } + }); + + result.push(currentType); + }); + + return result.filter(function (type, index) { + return exclude.indexOf(index) === -1; + }); +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {} + }, index, length; + + function collectType(type) { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; + + this.implicit.forEach(function (type) { + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + }); + + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} + + +Schema.DEFAULT = null; + + +Schema.create = function createSchema() { + var schemas, types; + + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } + + schemas = common.toArray(schemas); + types = common.toArray(types); + + if (!schemas.every(function (schema) { return schema instanceof Schema; })) { + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + } + + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; + + +module.exports = Schema; + +},{"./common":2,"./exception":4,"./type":13}],8:[function(require,module,exports){ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./json') + ] +}); + +},{"../schema":7,"./json":12}],9:[function(require,module,exports){ +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = Schema.DEFAULT = new Schema({ + include: [ + require('./default_safe') + ], + explicit: [ + require('../type/js/undefined'), + require('../type/js/regexp'), + require('../type/js/function') + ] +}); + +},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(require,module,exports){ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./core') + ], + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); + +},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(require,module,exports){ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); + +},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(require,module,exports){ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./failsafe') + ], + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); + +},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(require,module,exports){ +'use strict'; + +var YAMLException = require('./exception'); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; + +},{"./exception":4}],14:[function(require,module,exports){ +'use strict'; + +/*eslint-disable no-bitwise*/ + +var NodeBuffer; + +try { + // A trick for browserified version, to not include `Buffer` shim + var _require = require; + NodeBuffer = _require('buffer').Buffer; +} catch (__) {} + +var Type = require('../type'); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + // Support node 6.+ Buffer API when available + return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); + } + + return result; +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); + +},{"../type":13}],15:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); + +},{"../type":13}],16:[function(require,module,exports){ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // 20:59 + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign, base, digits; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + digits = []; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + + } else if (value.indexOf(':') >= 0) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); + + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; + + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); + +},{"../common":2,"../type":13}],17:[function(require,module,exports){ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 10 (except 0) or base 60 + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch === ':') break; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + // if !base60 - done; + if (ch !== ':') return true; + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value, 16); + return sign * parseInt(value, 8); + } + + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); + + value = 0; + base = 1; + + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); + + return sign * value; + + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); + +},{"../common":2,"../type":13}],18:[function(require,module,exports){ +'use strict'; + +var esprima; + +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + // workaround to exclude package from browserify list. + var _require = require; + esprima = _require('esprima'); +} catch (_) { + /* eslint-disable no-redeclare */ + /* global window */ + if (typeof window !== 'undefined') esprima = window.esprima; +} + +var Type = require('../../type'); + +function resolveJavascriptFunction(data) { + if (data === null) return false; + + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }); + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + return false; + } + + return true; + } catch (err) { + return false; + } +} + +function constructJavascriptFunction(data) { + /*jslint evil:true*/ + + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + throw new Error('Failed to resolve function'); + } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + if (ast.body[0].expression.body.type === 'BlockStatement') { + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); + } + // ES6 arrow functions can omit the BlockStatement. In that case, just return + // the body. + /*eslint-disable no-new-func*/ + return new Function(params, 'return ' + source.slice(body[0], body[1])); +} + +function representJavascriptFunction(object /*, style*/) { + return object.toString(); +} + +function isFunction(object) { + return Object.prototype.toString.call(object) === '[object Function]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); + +},{"../../type":13}],19:[function(require,module,exports){ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptRegExp(data) { + if (data === null) return false; + if (data.length === 0) return false; + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + + if (modifiers.length > 3) return false; + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; + } + + return true; +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + return new RegExp(regexp, modifiers); +} + +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; + + if (object.global) result += 'g'; + if (object.multiline) result += 'm'; + if (object.ignoreCase) result += 'i'; + + return result; +} + +function isRegExp(object) { + return Object.prototype.toString.call(object) === '[object RegExp]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); + +},{"../../type":13}],20:[function(require,module,exports){ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return typeof object === 'undefined'; +} + +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); + +},{"../../type":13}],21:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); + +},{"../type":13}],22:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); + +},{"../type":13}],23:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); + +},{"../type":13}],24:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); + +},{"../type":13}],25:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); + +},{"../type":13}],26:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); + +},{"../type":13}],27:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); + +},{"../type":13}],28:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); + +},{"../type":13}],29:[function(require,module,exports){ +'use strict'; + +var Type = require('../type'); + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); + +},{"../type":13}],"/":[function(require,module,exports){ +'use strict'; + + +var yaml = require('./lib/js-yaml.js'); + + +module.exports = yaml; + +},{"./lib/js-yaml.js":1}]},{},[])("/") +}); diff --git a/node_modules/js-yaml/dist/js-yaml.min.js b/node_modules/js-yaml/dist/js-yaml.min.js new file mode 100644 index 00000000..f72401ea --- /dev/null +++ b/node_modules/js-yaml/dist/js-yaml.min.js @@ -0,0 +1 @@ +!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsyaml=e()}(function(){return function o(a,s,c){function u(t,e){if(!s[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(l)return l(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var r=s[t]={exports:{}};a[t][0].call(r.exports,function(e){return u(a[t][1][e]||e)},r,r.exports,o,a,s,c)}return s[t].exports}for(var l="function"==typeof require&&require,e=0;e=i.flowLevel;switch(V(r,n,i.indent,t,function(e){return function(e,t){for(var n=0,i=e.implicitTypes.length;n"+z(r,i.indent)+J(U(function(t,n){var e,i,r=/(\n+)([^\n]*)/g,o=function(){var e=-1!==(e=t.indexOf("\n"))?e:t.length;return r.lastIndex=e,Q(t.slice(0,e),n)}(),a="\n"===t[0]||" "===t[0];for(;i=r.exec(t);){var s=i[1],c=i[2];e=" "===c[0],o+=s+(a||e||""===c?"":"\n")+Q(c,n),a=e}return o}(r,t),e));case G:return'"'+function(e){for(var t,n,i,r="",o=0;ot&&o tag resolver accepts not "'+o+'" style');i=r.represent[o](t,o)}e.dump=i}return 1}}function ee(e,t,n,i,r,o){e.tag=null,e.dump=n,X(e,n,!1)||X(e,n,!0);var a=p.call(e.dump);i=i&&(e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(c=-1!==(s=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&0 "+e.dump)}return 1}function te(e,t){var n,i,r=[],o=[];for(!function e(t,n,i){var r,o,a;if(null!==t&&"object"==typeof t)if(-1!==(o=n.indexOf(t)))-1===i.indexOf(o)&&i.push(o);else if(n.push(t),Array.isArray(t))for(o=0,a=t.length;o>10),56320+(s-65536&1023)),e.position++}else N(e,"unknown escape sequence");n=i=e.position}else O(p)?(L(e,n,i,!0),B(e,Y(e,!1,t)),n=i=e.position):e.position===e.lineStart&&R(e)?N(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}N(e,"unexpected end of the stream within a double quoted scalar")}}function W(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&45===i&&F(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,Y(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,K(e,t,A,!1,!0),a.push(e.result),Y(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)N(e,"bad indentation of a sequence entry");else if(e.lineIndentt?d=1:e.lineIndent===t?d=0:e.lineIndentt?d=1:e.lineIndent===t?d=0:e.lineIndentt)&&(K(e,t,b,!0,r)&&(m?d=e.result:h=e.result),m||(U(e,l,p,f,d,h,o,a),f=d=h=null),Y(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)N(e,"bad indentation of a mapping entry");else if(e.lineIndentu&&(u=e.lineIndent),O(f))l++;else{if(e.lineIndent=t){a=!0,f=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=c,e.lineIndent=u;break}}a&&(L(e,r,o,!1),B(e,e.line-s),r=o=e.position,a=!1),E(f)||(o=e.position+1),f=e.input.charCodeAt(++e.position)}if(L(e,r,o,!1),e.result)return 1;e.kind=l,e.result=p}}(e,p,x===n)&&(m=!0,null===e.tag&&(e.tag="?")):(m=!0,null===e.tag&&null===e.anchor||N(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(m=s&&W(e,f))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&N(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,u=e.implicitTypes.length;c tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):N(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):N(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||m}function $(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new h(e,t),i=e.indexOf("\0");for(-1!==i&&(n.position=i,N(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.positiont/2-1){n=" ... ",i+=5;break}for(r="",o=this.position;ot/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(i,o),s.repeat(" ",e)+n+a+r+"\n"+s.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";var r=e("./common"),o=e("./exception"),a=e("./type");function s(e,t,i){var r=[];return e.include.forEach(function(e){i=s(e,t,i)}),e[t].forEach(function(n){i.forEach(function(e,t){e.tag===n.tag&&e.kind===n.kind&&r.push(t)}),i.push(n)}),i.filter(function(e,t){return-1===r.indexOf(t)})}function c(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=s(this,"implicit",[]),this.compiledExplicit=s(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function i(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e>16&255),a.push(o>>8&255),a.push(255&o)),o=o<<6|r.indexOf(n.charAt(s));return 0==(t=i%4*6)?(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)):18==t?(a.push(o>>10&255),a.push(o>>2&255)):12==t&&a.push(o>>4&255),c?c.from?c.from(a):new c(a):a},predicate:function(e){return c&&c.isBuffer(e)},represent:function(e){for(var t,n="",i=0,r=e.length,o=u,a=0;a>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]),i=(i<<8)+e[a];return 0==(t=r%3)?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]):2==t?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):1==t&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}})},{"../type":13}],15:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type"),o=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var a=/^[-+]?[0-9]+e/;t.exports=new r("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!o.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n=e.replace(/_/g,"").toLowerCase(),i="-"===n[0]?-1:1,r=[];return 0<="+-".indexOf(n[0])&&(n=n.slice(1)),".inf"===n?1==i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===n?NaN:0<=n.indexOf(":")?(n.split(":").forEach(function(e){r.unshift(parseFloat(e,10))}),n=0,t=1,r.forEach(function(e){n+=e*t,t*=60}),i*n):i*parseFloat(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type");t.exports=new r("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i,r,o=e.length,a=0,s=!1;if(!o)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===o)return!0;if("b"===(t=e[++a])){for(a++;a */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ + +var ESCAPE_SEQUENCES = {}; + +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; + +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; + +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; + + if (map === null) return {}; + + result = {}; + keys = Object.keys(map); + + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; +} + +function encodeHex(character) { + var string, handle, length; + + string = character.toString(16).toUpperCase(); + + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + } + + return '\\' + handle + common.repeat('0', length - string.length) + string; +} + +function State(options) { + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; +} + +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; + + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; + } else { + line = string.slice(position, next + 1); + position = next + 1; + } + + if (line.length && line !== '\n') result += ind; + + result += line; + } + + return result; +} + +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); +} + +function testImplicitResolving(state, str) { + var index, length, type; + + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; + + if (type.resolve(str)) { + return true; + } + } + + return false; +} + +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} + +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) + || (0x10000 <= c && c <= 0x10FFFF); +} + +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// [24] b-line-feed ::= #xA /* LF */ +// [25] b-carriage-return ::= #xD /* CR */ +// [3] c-byte-order-mark ::= #xFEFF +function isNsChar(c) { + return isPrintable(c) && !isWhitespace(c) + // byte-order-mark + && c !== 0xFEFF + // b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} + +// Simplified test for values allowed after the first character in plain style. +function isPlainSafe(c, prev) { + // Uses a subset of nb-char - c-flow-indicator - ":" - "#" + // where nb-char ::= c-printable - b-char - c-byte-order-mark. + return isPrintable(c) && c !== 0xFEFF + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // - ":" - "#" + // /* An ns-char preceding */ "#" + && c !== CHAR_COLON + && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); +} + +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + return isPrintable(c) && c !== 0xFEFF + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} + +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} + +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; + +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { + var i; + var char, prev_char; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(string.charCodeAt(0)) + && !isWhitespace(string.charCodeAt(string.length - 1)); + + if (singleLineOnly) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; + } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + prev_char = i > 0 ? string.charCodeAt(i - 1) : null; + plain = plain && isPlainSafe(char, prev_char); + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + return plain && !testAmbiguousType(string) + ? STYLE_PLAIN : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; +} + +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey) { + state.dump = (function () { + if (string.length === 0) { + return "''"; + } + if (!state.noCompatMode && + DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { + return "'" + string + "'"; + } + + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } + + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} + +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; + + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); + + return indentIndicator + chomp + '\n'; +} + +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} + +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; + + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; + + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; + } + + return result; +} + +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; + + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; + + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; + } + + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); + } + + return result.slice(1); // drop extra \n joiner +} + +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char, nextChar; + var escapeSeq; + + for (var i = 0; i < string.length; i++) { + char = string.charCodeAt(i); + // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). + if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { + nextChar = string.charCodeAt(i + 1); + if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { + // Combine the surrogate pair and store it escaped. + result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); + // Advance index one extra since we already used that char here. + i++; continue; + } + } + escapeSeq = ESCAPE_SEQUENCES[char]; + result += !escapeSeq && isPrintable(char) + ? string[i] + : escapeSeq || encodeHex(char); + } + + return result; +} + +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level, object[index], false, false)) { + if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = '[' + _result + ']'; +} + +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length; + + for (index = 0, length = object.length; index < length; index += 1) { + // Write only valid elements. + if (writeNode(state, level + 1, object[index], true, true)) { + if (!compact || index !== 0) { + _result += generateNextLine(state, level); + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } + + _result += state.dump; + } + } + + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. +} + +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + + pairBuffer = ''; + if (index !== 0) pairBuffer += ', '; + + if (state.condenseFlow) pairBuffer += '"'; + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } + + if (state.dump.length > 1024) pairBuffer += '? '; + + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = '{' + _result + '}'; +} + +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; + + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; + + if (!compact || index !== 0) { + pairBuffer += generateNextLine(state, level); + } + + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; + + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } + + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); + + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } + + pairBuffer += state.dump; + + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } + + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. + } + + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; + } else { + pairBuffer += ': '; + } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; + } + + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. +} + +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; + + typeList = explicit ? state.explicitTypes : state.implicitTypes; + + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; + + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { + + state.tag = explicit ? type.tag : '?'; + + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; + + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } + + state.dump = _result; + } + + return true; + } + } + + return false; +} + +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); + } + + var type = _toString.call(state.dump); + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); + } + + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; + + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; + } + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; + } + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; + if (block && (state.dump.length !== 0)) { + writeBlockSequence(state, arrayLevel, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, arrayLevel, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey); + } + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + state.dump = '!<' + state.tag + '> ' + state.dump; + } + } + + return true; +} + +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; + + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); + } + state.usedDuplicates = new Array(length); +} + +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; + + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } +} + +function dump(input, options) { + options = options || {}; + + var state = new State(options); + + if (!state.noRefs) getDuplicateReferences(input, state); + + if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; + + return ''; +} + +function safeDump(input, options) { + return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + +module.exports.dump = dump; +module.exports.safeDump = safeDump; diff --git a/node_modules/js-yaml/lib/js-yaml/exception.js b/node_modules/js-yaml/lib/js-yaml/exception.js new file mode 100644 index 00000000..b744a1ee --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/exception.js @@ -0,0 +1,43 @@ +// YAML error class. http://stackoverflow.com/questions/8458984 +// +'use strict'; + +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); + + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); + + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; + } +} + + +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; + + +YAMLException.prototype.toString = function toString(compact) { + var result = this.name + ': '; + + result += this.reason || '(unknown reason)'; + + if (!compact && this.mark) { + result += ' ' + this.mark.toString(); + } + + return result; +}; + + +module.exports = YAMLException; diff --git a/node_modules/js-yaml/lib/js-yaml/loader.js b/node_modules/js-yaml/lib/js-yaml/loader.js new file mode 100644 index 00000000..ef01386b --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/loader.js @@ -0,0 +1,1644 @@ +'use strict'; + +/*eslint-disable max-len,no-use-before-define*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Mark = require('./mark'); +var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe'); +var DEFAULT_FULL_SCHEMA = require('./schema/default_full'); + + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + + +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; + + +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; + + +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + + +function _class(obj) { return Object.prototype.toString.call(obj); } + +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} + +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} + +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} + +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} + +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + /*eslint-disable no-bitwise*/ + lc = c | 0x20; + + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; + } + + return -1; +} + +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} + +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; + } + + return -1; +} + +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; +} + +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); +} + +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); +} + + +function State(input, options) { + this.input = input; + + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; + this.onWarning = options['onWarning'] || null; + this.legacy = options['legacy'] || false; + this.json = options['json'] || false; + this.listener = options['listener'] || null; + + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + + this.documents = []; + + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ + +} + + +function generateError(state, message) { + return new YAMLException( + message, + new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); +} + +function throwError(state, message) { + throw generateError(state, message); +} + +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); + } +} + + +var directiveHandlers = { + + YAML: function handleYamlDirective(state, name, args) { + + var match, major, minor; + + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } + + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } + + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } + + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); + + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); + } + + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); + } + }, + + TAG: function handleTagDirective(state, name, args) { + + var handle, prefix; + + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); + } + + handle = args[0]; + prefix = args[1]; + + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } + + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + } + + state.tagMap[handle] = prefix; + } +}; + + +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; + + if (start < end) { + _result = state.input.slice(start, end); + + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); + } + + state.result += _result; + } +} + +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + } + + sourceKeys = Object.keys(source); + + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + + if (!_hasOwnProperty.call(destination, key)) { + destination[key] = source[key]; + overridableKeys[key] = true; + } + } +} + +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { + var index, quantity; + + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); + } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; + } + } + } + + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } + + + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state, _result, valueNode, overridableKeys); + } + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); + } + _result[keyNode] = valueNode; + delete overridableKeys[keyNode]; + } + + return _result; +} + +function readLineBreak(state) { + var ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } + + state.line += 1; + state.lineStart = state.position; +} + +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } + + if (is_EOL(ch)) { + readLineBreak(state); + + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; + + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + } else { + break; + } + } + + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } + + return lineBreaks; +} + +function testDocumentSeparator(state) { + var _position = state.position, + ch; + + ch = state.input.charCodeAt(_position); + + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { + + _position += 3; + + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + + return false; +} + +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} + + +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; + + ch = state.input.charCodeAt(state.position); + + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; + } + + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; + + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + + if (is_WS_OR_EOL(preceding)) { + break; + } + + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); + + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } + + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } + + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, captureEnd, false); + + if (state.result) { + return true; + } + + state.kind = _kind; + state.result = _result; + return false; +} + +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x27/* ' */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} + +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x22/* " */) { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); + + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); + + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; + + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); + + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + + } else { + throwError(state, 'expected hexadecimal character'); + } + } + + state.result += charFromCodepoint(hexResult); + + state.position++; + + } else { + throwError(state, 'unknown escape sequence'); + } + + captureStart = captureEnd = state.position; + + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); + + } else { + state.position++; + captureEnd = state.position; + } + } + + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} + +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = {}, + keyNode, + keyTag, + valueNode, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(++state.position); + + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } + + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); + + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } + + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); + } else { + _result.push(keyNode); + } + + skipSeparationSpace(state, true, nodeIndent); + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } + + throwError(state, 'unexpected end of the stream within a flow collection'); +} + +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } + + state.kind = 'scalar'; + state.result = ''; + + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } + + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } + + } else { + break; + } + } + + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } + + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; + + ch = state.input.charCodeAt(state.position); + + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } + + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } + + if (is_EOL(ch)) { + emptyLines++; + continue; + } + + // End of the scalar. + if (state.lineIndent < textIndent) { + + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } + + // Break this `while` cycle and go to the funciton's epilogue. + break; + } + + // Folded style: use fancy rules to handle line breaks. + if (folding) { + + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); + + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } + + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } + + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; + + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } + + captureSegment(state, captureStart, state.position, false); + } + + return true; +} + +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + + if (ch !== 0x2D/* - */) { + break; + } + + following = state.input.charCodeAt(state.position + 1); + + if (!is_WS_OR_EOL(following)) { + break; + } + + detected = true; + state.position++; + + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } + + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} + +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _pos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = {}, + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + + ch = state.input.charCodeAt(state.position); + + while (ch !== 0) { + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + _pos = state.position; + + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { + + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = true; + allowCompact = true; + + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; + + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + + state.position += 1; + ch = following; + + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); + + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); + + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } + + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + keyTag = keyNode = valueNode = null; + } + + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; + + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); + + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } + + } else { + break; // Reading is done. Go to the epilogue. + } + + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } + + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); + keyTag = keyNode = valueNode = null; + } + + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); + } + + if (state.lineIndent > nodeIndent && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } + + // + // Epilogue. + // + + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + } + + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; + } + + return detected; +} + +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x21/* ! */) return false; + + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } + + ch = state.input.charCodeAt(++state.position); + + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); + + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); + + } else { + tagHandle = '!'; + } + + _position = state.position; + + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); + + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); + + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } + + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } + + ch = state.input.charCodeAt(++state.position); + } + + tagName = state.input.slice(_position, state.position); + + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } + + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } + + if (isVerbatim) { + state.tag = tagName; + + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; + + } else if (tagHandle === '!') { + state.tag = '!' + tagName; + + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; + + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } + + return true; +} + +function readAnchorProperty(state) { + var _position, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x26/* & */) return false; + + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } + + state.anchor = state.input.slice(_position, state.position); + return true; +} + +function readAlias(state) { + var _position, alias, + ch; + + ch = state.input.charCodeAt(state.position); + + if (ch !== 0x2A/* * */) return false; + + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } + + alias = state.input.slice(_position, state.position); + + if (!state.anchorMap.hasOwnProperty(alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } + + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} + +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + + blockIndent = state.position - state.lineStart; + + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + + } else if (readAlias(state)) { + hasContent = true; + + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } + + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + + if (state.tag === null) { + state.tag = '?'; + } + } + + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } + + if (state.tag !== null && state.tag !== '!') { + if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } + + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } + + if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; +} + +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = {}; + state.anchorMap = {}; + + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); + + ch = state.input.charCodeAt(state.position); + + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; + } + + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; + + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } + + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } + + if (is_EOL(ch)) break; + + _position = state.position; + + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } + + directiveArgs.push(state.input.slice(_position, state.position)); + } + + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } + } + + skipSeparationSpace(state, true, -1); + + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } + + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); + + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } + + state.documents.push(state.result); + + if (state.position === state.lineStart && testDocumentSeparator(state)) { + + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; + } + + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} + + +function loadDocuments(input, options) { + input = String(input); + options = options || {}; + + if (input.length !== 0) { + + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; + } + + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); + } + } + + var state = new State(input, options); + + var nullpos = input.indexOf('\0'); + + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } + + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; + + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; + } + + while (state.position < (state.length - 1)) { + readDocument(state); + } + + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); +} + + +function safeLoadAll(input, iterator, options) { + if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { + options = iterator; + iterator = null; + } + + return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +function safeLoad(input, options) { + return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); +} + + +module.exports.loadAll = loadAll; +module.exports.load = load; +module.exports.safeLoadAll = safeLoadAll; +module.exports.safeLoad = safeLoad; diff --git a/node_modules/js-yaml/lib/js-yaml/mark.js b/node_modules/js-yaml/lib/js-yaml/mark.js new file mode 100644 index 00000000..47b265c2 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/mark.js @@ -0,0 +1,76 @@ +'use strict'; + + +var common = require('./common'); + + +function Mark(name, buffer, position, line, column) { + this.name = name; + this.buffer = buffer; + this.position = position; + this.line = line; + this.column = column; +} + + +Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { + var head, start, tail, end, snippet; + + if (!this.buffer) return null; + + indent = indent || 4; + maxLength = maxLength || 75; + + head = ''; + start = this.position; + + while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { + start -= 1; + if (this.position - start > (maxLength / 2 - 1)) { + head = ' ... '; + start += 5; + break; + } + } + + tail = ''; + end = this.position; + + while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { + end += 1; + if (end - this.position > (maxLength / 2 - 1)) { + tail = ' ... '; + end -= 5; + break; + } + } + + snippet = this.buffer.slice(start, end); + + return common.repeat(' ', indent) + head + snippet + tail + '\n' + + common.repeat(' ', indent + this.position - start + head.length) + '^'; +}; + + +Mark.prototype.toString = function toString(compact) { + var snippet, where = ''; + + if (this.name) { + where += 'in "' + this.name + '" '; + } + + where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + + if (!compact) { + snippet = this.getSnippet(); + + if (snippet) { + where += ':\n' + snippet; + } + } + + return where; +}; + + +module.exports = Mark; diff --git a/node_modules/js-yaml/lib/js-yaml/schema.js b/node_modules/js-yaml/lib/js-yaml/schema.js new file mode 100644 index 00000000..ca7cf47e --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/schema.js @@ -0,0 +1,108 @@ +'use strict'; + +/*eslint-disable max-len*/ + +var common = require('./common'); +var YAMLException = require('./exception'); +var Type = require('./type'); + + +function compileList(schema, name, result) { + var exclude = []; + + schema.include.forEach(function (includedSchema) { + result = compileList(includedSchema, name, result); + }); + + schema[name].forEach(function (currentType) { + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { + exclude.push(previousIndex); + } + }); + + result.push(currentType); + }); + + return result.filter(function (type, index) { + return exclude.indexOf(index) === -1; + }); +} + + +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {} + }, index, length; + + function collectType(type) { + result[type.kind][type.tag] = result['fallback'][type.tag] = type; + } + + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); + } + return result; +} + + +function Schema(definition) { + this.include = definition.include || []; + this.implicit = definition.implicit || []; + this.explicit = definition.explicit || []; + + this.implicit.forEach(function (type) { + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + } + }); + + this.compiledImplicit = compileList(this, 'implicit', []); + this.compiledExplicit = compileList(this, 'explicit', []); + this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); +} + + +Schema.DEFAULT = null; + + +Schema.create = function createSchema() { + var schemas, types; + + switch (arguments.length) { + case 1: + schemas = Schema.DEFAULT; + types = arguments[0]; + break; + + case 2: + schemas = arguments[0]; + types = arguments[1]; + break; + + default: + throw new YAMLException('Wrong number of arguments for Schema.create function'); + } + + schemas = common.toArray(schemas); + types = common.toArray(types); + + if (!schemas.every(function (schema) { return schema instanceof Schema; })) { + throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + } + + if (!types.every(function (type) { return type instanceof Type; })) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + + return new Schema({ + include: schemas, + explicit: types + }); +}; + + +module.exports = Schema; diff --git a/node_modules/js-yaml/lib/js-yaml/schema/core.js b/node_modules/js-yaml/lib/js-yaml/schema/core.js new file mode 100644 index 00000000..206daab5 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/schema/core.js @@ -0,0 +1,18 @@ +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./json') + ] +}); diff --git a/node_modules/js-yaml/lib/js-yaml/schema/default_full.js b/node_modules/js-yaml/lib/js-yaml/schema/default_full.js new file mode 100644 index 00000000..a55ef42a --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/schema/default_full.js @@ -0,0 +1,25 @@ +// JS-YAML's default schema for `load` function. +// It is not described in the YAML specification. +// +// This schema is based on JS-YAML's default safe schema and includes +// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. +// +// Also this schema is used as default base schema at `Schema.create` function. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = Schema.DEFAULT = new Schema({ + include: [ + require('./default_safe') + ], + explicit: [ + require('../type/js/undefined'), + require('../type/js/regexp'), + require('../type/js/function') + ] +}); diff --git a/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js b/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js new file mode 100644 index 00000000..11d89bbf --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js @@ -0,0 +1,28 @@ +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./core') + ], + implicit: [ + require('../type/timestamp'), + require('../type/merge') + ], + explicit: [ + require('../type/binary'), + require('../type/omap'), + require('../type/pairs'), + require('../type/set') + ] +}); diff --git a/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js b/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js new file mode 100644 index 00000000..b7a33eb7 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js @@ -0,0 +1,17 @@ +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + explicit: [ + require('../type/str'), + require('../type/seq'), + require('../type/map') + ] +}); diff --git a/node_modules/js-yaml/lib/js-yaml/schema/json.js b/node_modules/js-yaml/lib/js-yaml/schema/json.js new file mode 100644 index 00000000..5be3dbf8 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/schema/json.js @@ -0,0 +1,25 @@ +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. + + +'use strict'; + + +var Schema = require('../schema'); + + +module.exports = new Schema({ + include: [ + require('./failsafe') + ], + implicit: [ + require('../type/null'), + require('../type/bool'), + require('../type/int'), + require('../type/float') + ] +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type.js b/node_modules/js-yaml/lib/js-yaml/type.js new file mode 100644 index 00000000..90b702ac --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type.js @@ -0,0 +1,61 @@ +'use strict'; + +var YAMLException = require('./exception'); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); + }); + } + + return result; +} + +function Type(tag, options) { + options = options || {}; + + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + + // TODO: Add tag format check. + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} + +module.exports = Type; diff --git a/node_modules/js-yaml/lib/js-yaml/type/binary.js b/node_modules/js-yaml/lib/js-yaml/type/binary.js new file mode 100644 index 00000000..10b18755 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/binary.js @@ -0,0 +1,138 @@ +'use strict'; + +/*eslint-disable no-bitwise*/ + +var NodeBuffer; + +try { + // A trick for browserified version, to not include `Buffer` shim + var _require = require; + NodeBuffer = _require('buffer').Buffer; +} catch (__) {} + +var Type = require('../type'); + + +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; + + +function resolveYamlBinary(data) { + if (data === null) return false; + + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); + + // Skip CR/LF + if (code > 64) continue; + + // Fail on illegal characters + if (code < 0) return false; + + bitlen += 6; + } + + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} + +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; + + // Collect by 6*4 bits (3 bytes) + + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } + + // Dump tail + + tailbits = (max % 4) * 6; + + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + + // Wrap into Buffer for NodeJS and leave Array for browser + if (NodeBuffer) { + // Support node 6.+ Buffer API when available + return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); + } + + return result; +} + +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + + // Convert every three bytes to 4 ASCII characters. + + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + + bits = (bits << 8) + object[idx]; + } + + // Dump tail + + tail = max % 3; + + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; +} + +function isBinary(object) { + return NodeBuffer && NodeBuffer.isBuffer(object); +} + +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/bool.js b/node_modules/js-yaml/lib/js-yaml/type/bool.js new file mode 100644 index 00000000..cb774593 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/bool.js @@ -0,0 +1,35 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlBoolean(data) { + if (data === null) return false; + + var max = data.length; + + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} + +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} + +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} + +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/float.js b/node_modules/js-yaml/lib/js-yaml/type/float.js new file mode 100644 index 00000000..127671b2 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/float.js @@ -0,0 +1,116 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // 20:59 + '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); + +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; +} + +function constructYamlFloat(data) { + var value, sign, base, digits; + + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + digits = []; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); + } + + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; + + } else if (value.indexOf(':') >= 0) { + value.split(':').forEach(function (v) { + digits.unshift(parseFloat(v, 10)); + }); + + value = 0.0; + base = 1; + + digits.forEach(function (d) { + value += d * base; + base *= 60; + }); + + return sign * value; + + } + return sign * parseFloat(value, 10); +} + + +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; + } + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; + } + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; +} + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/int.js b/node_modules/js-yaml/lib/js-yaml/type/int.js new file mode 100644 index 00000000..ba61c5f9 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/int.js @@ -0,0 +1,173 @@ +'use strict'; + +var common = require('../common'); +var Type = require('../type'); + +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); +} + +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} + +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} + +function resolveYamlInteger(data) { + if (data === null) return false; + + var max = data.length, + index = 0, + hasDigits = false, + ch; + + if (!max) return false; + + ch = data[index]; + + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } + + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; + + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 8 + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; + } + + // base 10 (except 0) or base 60 + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch === ':') break; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + // if !base60 - done; + if (ch !== ':') return true; + + // base60 almost not used, no needs to optimize + return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); +} + +function constructYamlInteger(data) { + var value = data, sign = 1, ch, base, digits = []; + + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } + + ch = value[0]; + + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; + } + + if (value === '0') return 0; + + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value, 16); + return sign * parseInt(value, 8); + } + + if (value.indexOf(':') !== -1) { + value.split(':').forEach(function (v) { + digits.unshift(parseInt(v, 10)); + }); + + value = 0; + base = 1; + + digits.forEach(function (d) { + value += (d * base); + base *= 60; + }); + + return sign * value; + + } + + return sign * parseInt(value, 10); +} + +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/js/function.js b/node_modules/js-yaml/lib/js-yaml/type/js/function.js new file mode 100644 index 00000000..8fab8c43 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/js/function.js @@ -0,0 +1,93 @@ +'use strict'; + +var esprima; + +// Browserified version does not have esprima +// +// 1. For node.js just require module as deps +// 2. For browser try to require mudule via external AMD system. +// If not found - try to fallback to window.esprima. If not +// found too - then fail to parse. +// +try { + // workaround to exclude package from browserify list. + var _require = require; + esprima = _require('esprima'); +} catch (_) { + /* eslint-disable no-redeclare */ + /* global window */ + if (typeof window !== 'undefined') esprima = window.esprima; +} + +var Type = require('../../type'); + +function resolveJavascriptFunction(data) { + if (data === null) return false; + + try { + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }); + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + return false; + } + + return true; + } catch (err) { + return false; + } +} + +function constructJavascriptFunction(data) { + /*jslint evil:true*/ + + var source = '(' + data + ')', + ast = esprima.parse(source, { range: true }), + params = [], + body; + + if (ast.type !== 'Program' || + ast.body.length !== 1 || + ast.body[0].type !== 'ExpressionStatement' || + (ast.body[0].expression.type !== 'ArrowFunctionExpression' && + ast.body[0].expression.type !== 'FunctionExpression')) { + throw new Error('Failed to resolve function'); + } + + ast.body[0].expression.params.forEach(function (param) { + params.push(param.name); + }); + + body = ast.body[0].expression.body.range; + + // Esprima's ranges include the first '{' and the last '}' characters on + // function expressions. So cut them out. + if (ast.body[0].expression.body.type === 'BlockStatement') { + /*eslint-disable no-new-func*/ + return new Function(params, source.slice(body[0] + 1, body[1] - 1)); + } + // ES6 arrow functions can omit the BlockStatement. In that case, just return + // the body. + /*eslint-disable no-new-func*/ + return new Function(params, 'return ' + source.slice(body[0], body[1])); +} + +function representJavascriptFunction(object /*, style*/) { + return object.toString(); +} + +function isFunction(object) { + return Object.prototype.toString.call(object) === '[object Function]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/function', { + kind: 'scalar', + resolve: resolveJavascriptFunction, + construct: constructJavascriptFunction, + predicate: isFunction, + represent: representJavascriptFunction +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js b/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js new file mode 100644 index 00000000..43fa4701 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js @@ -0,0 +1,60 @@ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptRegExp(data) { + if (data === null) return false; + if (data.length === 0) return false; + + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // if regexp starts with '/' it can have modifiers and must be properly closed + // `/foo/gim` - modifiers tail can be maximum 3 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + + if (modifiers.length > 3) return false; + // if expression starts with /, is should be properly terminated + if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; + } + + return true; +} + +function constructJavascriptRegExp(data) { + var regexp = data, + tail = /\/([gim]*)$/.exec(data), + modifiers = ''; + + // `/foo/gim` - tail can be maximum 4 chars + if (regexp[0] === '/') { + if (tail) modifiers = tail[1]; + regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + } + + return new RegExp(regexp, modifiers); +} + +function representJavascriptRegExp(object /*, style*/) { + var result = '/' + object.source + '/'; + + if (object.global) result += 'g'; + if (object.multiline) result += 'm'; + if (object.ignoreCase) result += 'i'; + + return result; +} + +function isRegExp(object) { + return Object.prototype.toString.call(object) === '[object RegExp]'; +} + +module.exports = new Type('tag:yaml.org,2002:js/regexp', { + kind: 'scalar', + resolve: resolveJavascriptRegExp, + construct: constructJavascriptRegExp, + predicate: isRegExp, + represent: representJavascriptRegExp +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js b/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js new file mode 100644 index 00000000..95b5569f --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js @@ -0,0 +1,28 @@ +'use strict'; + +var Type = require('../../type'); + +function resolveJavascriptUndefined() { + return true; +} + +function constructJavascriptUndefined() { + /*eslint-disable no-undefined*/ + return undefined; +} + +function representJavascriptUndefined() { + return ''; +} + +function isUndefined(object) { + return typeof object === 'undefined'; +} + +module.exports = new Type('tag:yaml.org,2002:js/undefined', { + kind: 'scalar', + resolve: resolveJavascriptUndefined, + construct: constructJavascriptUndefined, + predicate: isUndefined, + represent: representJavascriptUndefined +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/map.js b/node_modules/js-yaml/lib/js-yaml/type/map.js new file mode 100644 index 00000000..f327beeb --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/map.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/merge.js b/node_modules/js-yaml/lib/js-yaml/type/merge.js new file mode 100644 index 00000000..ae08a864 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/merge.js @@ -0,0 +1,12 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlMerge(data) { + return data === '<<' || data === null; +} + +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/null.js b/node_modules/js-yaml/lib/js-yaml/type/null.js new file mode 100644 index 00000000..6874daa6 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/null.js @@ -0,0 +1,34 @@ +'use strict'; + +var Type = require('../type'); + +function resolveYamlNull(data) { + if (data === null) return true; + + var max = data.length; + + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} + +function constructYamlNull() { + return null; +} + +function isNull(object) { + return object === null; +} + +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; } + }, + defaultStyle: 'lowercase' +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/omap.js b/node_modules/js-yaml/lib/js-yaml/type/omap.js new file mode 100644 index 00000000..b2b5323b --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/omap.js @@ -0,0 +1,44 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; + +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + + return true; +} + +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/pairs.js b/node_modules/js-yaml/lib/js-yaml/type/pairs.js new file mode 100644 index 00000000..74b52403 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/pairs.js @@ -0,0 +1,53 @@ +'use strict'; + +var Type = require('../type'); + +var _toString = Object.prototype.toString; + +function resolveYamlPairs(data) { + if (data === null) return true; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return true; +} + +function constructYamlPairs(data) { + if (data === null) return []; + + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; + } + + return result; +} + +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/seq.js b/node_modules/js-yaml/lib/js-yaml/type/seq.js new file mode 100644 index 00000000..be8f77f2 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/seq.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/set.js b/node_modules/js-yaml/lib/js-yaml/type/set.js new file mode 100644 index 00000000..f885a329 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/set.js @@ -0,0 +1,29 @@ +'use strict'; + +var Type = require('../type'); + +var _hasOwnProperty = Object.prototype.hasOwnProperty; + +function resolveYamlSet(data) { + if (data === null) return true; + + var key, object = data; + + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } + + return true; +} + +function constructYamlSet(data) { + return data !== null ? data : {}; +} + +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/str.js b/node_modules/js-yaml/lib/js-yaml/type/str.js new file mode 100644 index 00000000..27acc106 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/str.js @@ -0,0 +1,8 @@ +'use strict'; + +var Type = require('../type'); + +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); diff --git a/node_modules/js-yaml/lib/js-yaml/type/timestamp.js b/node_modules/js-yaml/lib/js-yaml/type/timestamp.js new file mode 100644 index 00000000..8fa9c586 --- /dev/null +++ b/node_modules/js-yaml/lib/js-yaml/type/timestamp.js @@ -0,0 +1,88 @@ +'use strict'; + +var Type = require('../type'); + +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day + +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} + +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; + + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + + if (match === null) throw new Error('Date resolve error'); + + // match: [1] year [2] month [3] day + + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); + + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); + } + + // match: [4] hour [5] minute [6] second [7] fraction + + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); + + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; + } + fraction = +fraction; + } + + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } + + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + + if (delta) date.setTime(date.getTime() - delta); + + return date; +} + +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} + +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); diff --git a/node_modules/js-yaml/package.json b/node_modules/js-yaml/package.json new file mode 100644 index 00000000..f088f59e --- /dev/null +++ b/node_modules/js-yaml/package.json @@ -0,0 +1,95 @@ +{ + "_from": "js-yaml@^3.6.1", + "_id": "js-yaml@3.14.0", + "_inBundle": false, + "_integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "_location": "/js-yaml", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "js-yaml@^3.6.1", + "name": "js-yaml", + "escapedName": "js-yaml", + "rawSpec": "^3.6.1", + "saveSpec": null, + "fetchSpec": "^3.6.1" + }, + "_requiredBy": [ + "/unified-engine" + ], + "_resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "_shasum": "a7a34170f26a21bb162424d8adacb4113a69e482", + "_spec": "js-yaml@^3.6.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-engine", + "author": { + "name": "Vladimir Zapparov", + "email": "dervus.grim@gmail.com" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + }, + "bugs": { + "url": "https://github.com/nodeca/js-yaml/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Aleksey V Zapparov", + "email": "ixti@member.fsf.org", + "url": "http://www.ixti.net/" + }, + { + "name": "Vitaly Puzrin", + "email": "vitaly@rcdesign.ru", + "url": "https://github.com/puzrin" + }, + { + "name": "Martin Grenfell", + "email": "martin.grenfell@gmail.com", + "url": "http://got-ravings.blogspot.com" + } + ], + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "deprecated": false, + "description": "YAML 1.2 parser and serializer", + "devDependencies": { + "ansi": "^0.3.1", + "benchmark": "^2.1.4", + "browserify": "^16.2.2", + "codemirror": "^5.13.4", + "eslint": "^7.0.0", + "fast-check": "^1.24.2", + "istanbul": "^0.4.5", + "mocha": "^7.1.2", + "uglify-js": "^3.0.1" + }, + "files": [ + "index.js", + "lib/", + "bin/", + "dist/" + ], + "homepage": "https://github.com/nodeca/js-yaml", + "jsdelivr": "dist/js-yaml.min.js", + "keywords": [ + "yaml", + "parser", + "serializer", + "pyyaml" + ], + "license": "MIT", + "name": "js-yaml", + "repository": { + "type": "git", + "url": "git+https://github.com/nodeca/js-yaml.git" + }, + "scripts": { + "test": "make test" + }, + "unpkg": "dist/js-yaml.min.js", + "version": "3.14.0" +} diff --git a/node_modules/json-parse-better-errors/CHANGELOG.md b/node_modules/json-parse-better-errors/CHANGELOG.md new file mode 100644 index 00000000..b1d212de --- /dev/null +++ b/node_modules/json-parse-better-errors/CHANGELOG.md @@ -0,0 +1,46 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +## [1.0.2](https://github.com/zkat/json-parse-better-errors/compare/v1.0.1...v1.0.2) (2018-03-30) + + +### Bug Fixes + +* **messages:** More friendly messages for non-string ([#1](https://github.com/zkat/json-parse-better-errors/issues/1)) ([a476d42](https://github.com/zkat/json-parse-better-errors/commit/a476d42)) + + + + +## [1.0.1](https://github.com/zkat/json-parse-better-errors/compare/v1.0.0...v1.0.1) (2017-08-16) + + +### Bug Fixes + +* **license:** oops. Forgot to update license.md ([efe2958](https://github.com/zkat/json-parse-better-errors/commit/efe2958)) + + + + +# 1.0.0 (2017-08-15) + + +### Features + +* **init:** Initial Commit ([562c977](https://github.com/zkat/json-parse-better-errors/commit/562c977)) + + +### BREAKING CHANGES + +* **init:** This is the first commit! + + + + +# 0.1.0 (2017-08-15) + + +### Features + +* **init:** Initial Commit ([9dd1a19](https://github.com/zkat/json-parse-better-errors/commit/9dd1a19)) diff --git a/node_modules/json-parse-better-errors/LICENSE.md b/node_modules/json-parse-better-errors/LICENSE.md new file mode 100644 index 00000000..c51842cc --- /dev/null +++ b/node_modules/json-parse-better-errors/LICENSE.md @@ -0,0 +1,7 @@ +Copyright 2017 Kat Marchán + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/json-parse-better-errors/README.md b/node_modules/json-parse-better-errors/README.md new file mode 100644 index 00000000..a1f0f0a5 --- /dev/null +++ b/node_modules/json-parse-better-errors/README.md @@ -0,0 +1,46 @@ +# json-parse-better-errors [![npm version](https://img.shields.io/npm/v/json-parse-better-errors.svg)](https://npm.im/json-parse-better-errors) [![license](https://img.shields.io/npm/l/json-parse-better-errors.svg)](https://npm.im/json-parse-better-errors) [![Travis](https://img.shields.io/travis/zkat/json-parse-better-errors.svg)](https://travis-ci.org/zkat/json-parse-better-errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/json-parse-better-errors?svg=true)](https://ci.appveyor.com/project/zkat/json-parse-better-errors) [![Coverage Status](https://coveralls.io/repos/github/zkat/json-parse-better-errors/badge.svg?branch=latest)](https://coveralls.io/github/zkat/json-parse-better-errors?branch=latest) + +[`json-parse-better-errors`](https://github.com/zkat/json-parse-better-errors) is a Node.js library for +getting nicer errors out of `JSON.parse()`, including context and position of the parse errors. + +## Install + +`$ npm install --save json-parse-better-errors` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * [`parse`](#parse) + +### Example + +```javascript +const parseJson = require('json-parse-better-errors') + +parseJson('"foo"') +parseJson('garbage') // more useful error message +``` + +### Features + +* Like JSON.parse, but the errors are better. + +### Contributing + +The npm team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! The [Contributor Guide](CONTRIBUTING.md) has all the information you need for everything from reporting bugs to contributing entire new features. Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear. + +All participants and maintainers in this project are expected to follow [Code of Conduct](CODE_OF_CONDUCT.md), and just generally be excellent to each other. + +Please refer to the [Changelog](CHANGELOG.md) for project history details, too. + +Happy hacking! + +### API + +#### `> parse(txt, ?reviver, ?context=20)` + +Works just like `JSON.parse`, but will include a bit more information when an +error happens. diff --git a/node_modules/json-parse-better-errors/index.js b/node_modules/json-parse-better-errors/index.js new file mode 100644 index 00000000..14644c2f --- /dev/null +++ b/node_modules/json-parse-better-errors/index.js @@ -0,0 +1,38 @@ +'use strict' + +module.exports = parseJson +function parseJson (txt, reviver, context) { + context = context || 20 + try { + return JSON.parse(txt, reviver) + } catch (e) { + if (typeof txt !== 'string') { + const isEmptyArray = Array.isArray(txt) && txt.length === 0 + const errorMessage = 'Cannot parse ' + + (isEmptyArray ? 'an empty array' : String(txt)) + throw new TypeError(errorMessage) + } + const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i) + const errIdx = syntaxErr + ? +syntaxErr[1] + : e.message.match(/^Unexpected end of JSON.*/i) + ? txt.length - 1 + : null + if (errIdx != null) { + const start = errIdx <= context + ? 0 + : errIdx - context + const end = errIdx + context >= txt.length + ? txt.length + : errIdx + context + e.message += ` while parsing near '${ + start === 0 ? '' : '...' + }${txt.slice(start, end)}${ + end === txt.length ? '' : '...' + }'` + } else { + e.message += ` while parsing '${txt.slice(0, context * 2)}'` + } + throw e + } +} diff --git a/node_modules/json-parse-better-errors/package.json b/node_modules/json-parse-better-errors/package.json new file mode 100644 index 00000000..7e285ebc --- /dev/null +++ b/node_modules/json-parse-better-errors/package.json @@ -0,0 +1,76 @@ +{ + "_from": "json-parse-better-errors@^1.0.1", + "_id": "json-parse-better-errors@1.0.2", + "_inBundle": false, + "_integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "_location": "/json-parse-better-errors", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "json-parse-better-errors@^1.0.1", + "name": "json-parse-better-errors", + "escapedName": "json-parse-better-errors", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/parse-json" + ], + "_resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "_shasum": "bb867cfb3450e69107c131d1c514bab3dc8bcaa9", + "_spec": "json-parse-better-errors@^1.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/parse-json", + "author": { + "name": "Kat Marchán", + "email": "kzm@zkat.tech" + }, + "bugs": { + "url": "https://github.com/zkat/json-parse-better-errors/issues" + }, + "bundleDependencies": false, + "config": { + "nyc": { + "exclude": [ + "node_modules/**", + "test/**" + ] + } + }, + "deprecated": false, + "description": "JSON.parse with context information on error", + "devDependencies": { + "nyc": "^10.3.2", + "standard": "^9.0.2", + "standard-version": "^4.1.0", + "tap": "^10.3.3", + "weallbehave": "^1.2.0", + "weallcontribute": "^1.0.8" + }, + "files": [ + "*.js" + ], + "homepage": "https://github.com/zkat/json-parse-better-errors#readme", + "keywords": [ + "JSON", + "parser" + ], + "license": "MIT", + "main": "index.js", + "name": "json-parse-better-errors", + "repository": { + "type": "git", + "url": "git+https://github.com/zkat/json-parse-better-errors.git" + }, + "scripts": { + "postrelease": "npm publish && git push --follow-tags", + "prerelease": "npm t", + "pretest": "standard", + "release": "standard-version -s", + "test": "tap -J --coverage test/*.js", + "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", + "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" + }, + "version": "1.0.2" +} diff --git a/node_modules/json5/CHANGELOG.md b/node_modules/json5/CHANGELOG.md new file mode 100644 index 00000000..6db820cb --- /dev/null +++ b/node_modules/json5/CHANGELOG.md @@ -0,0 +1,169 @@ +### v0.5.1 [[code][c0.5.1], [diff][d0.5.1]] + +[c0.5.1]: https://github.com/aseemk/json5/tree/v0.5.1 +[d0.5.1]: https://github.com/aseemk/json5/compare/v0.5.0...v0.5.1 + +This release includes a minor fix for indentations when stringifying empty +arrays. + +- Fix: Indents no longer appear in empty arrays when stringified. ([#134]) + + +### v0.5.0 [[code][c0.5.0], [diff][d0.5.0]] + +[c0.5.0]: https://github.com/aseemk/json5/tree/v0.5.0 +[d0.5.0]: https://github.com/aseemk/json5/compare/v0.4.0...v0.5.0 + +This release includes major internal changes and public API enhancements. + +- **Major:** JSON5 officially supports Node.js v4 LTS and v5. Support for + Node.js v0.6 and v0.8 have been dropped, while support for v0.10 and v0.12 + remain. + +- Fix: YUI Compressor no longer fails when compressing json5.js. ([#97]) + +- New: `parse` and the CLI provide line and column numbers when displaying error + messages. ([#101]; awesome work by [@amb26].) + + +### v0.4.0 [[code][c0.4.0], [diff][d0.4.0]] + +[c0.4.0]: https://github.com/aseemk/json5/tree/v0.4.0 +[d0.4.0]: https://github.com/aseemk/json5/compare/v0.2.0...v0.4.0 + +Note that v0.3.0 was tagged, but never published to npm, so this v0.4.0 +changelog entry includes v0.3.0 features. + +This is a massive release that adds `stringify` support, among other things. + +- **Major:** `JSON5.stringify()` now exists! + This method is analogous to the native `JSON.stringify()`; + it just avoids quoting keys where possible. + See the [usage documentation](./README.md#usage) for more. + ([#32]; huge thanks and props [@aeisenberg]!) + +- New: `NaN` and `-NaN` are now allowed number literals. + ([#30]; thanks [@rowanhill].) + +- New: Duplicate object keys are now allowed; the last value is used. + This is the same behavior as JSON. ([#57]; thanks [@jordanbtucker].) + +- Fix: Properly handle various whitespace and newline cases now. + E.g. JSON5 now properly supports escaped CR and CRLF newlines in strings, + and JSON5 now accepts the same whitespace as JSON (stricter than ES5). + ([#58], [#60], and [#63]; thanks [@jordanbtucker].) + +- New: Negative hexadecimal numbers (e.g. `-0xC8`) are allowed again. + (They were disallowed in v0.2.0; see below.) + It turns out they *are* valid in ES5, so JSON5 supports them now too. + ([#36]; thanks [@jordanbtucker]!) + + +### v0.2.0 [[code][c0.2.0], [diff][d0.2.0]] + +[c0.2.0]: https://github.com/aseemk/json5/tree/v0.2.0 +[d0.2.0]: https://github.com/aseemk/json5/compare/v0.1.0...v0.2.0 + +This release fixes some bugs and adds some more utility features to help you +express data more easily: + +- **Breaking:** Negative hexadecimal numbers (e.g. `-0xC8`) are rejected now. + While V8 (e.g. Chrome and Node) supported them, it turns out they're invalid + in ES5. This has been [fixed in V8][v8-hex-fix] (and by extension, Chrome + and Node), so JSON5 officially rejects them now, too. ([#36]) + +- New: Trailing decimal points in decimal numbers are allowed again. + (They were disallowed in v0.1.0; see below.) + They're allowed by ES5, and differentiating between integers and floats may + make sense on some platforms. ([#16]; thanks [@Midar].) + +- New: `Infinity` and `-Infinity` are now allowed number literals. + ([#30]; thanks [@pepkin88].) + +- New: Plus signs (`+`) in front of numbers are now allowed, since it can + be helpful in some contexts to explicitly mark numbers as positive. + (E.g. when a property represents changes or deltas.) + +- Fix: unescaped newlines in strings are rejected now. + ([#24]; thanks [@Midar].) + + +### v0.1.0 [[code][c0.1.0], [diff][d0.1.0]] + +[c0.1.0]: https://github.com/aseemk/json5/tree/v0.1.0 +[d0.1.0]: https://github.com/aseemk/json5/compare/v0.0.1...v0.1.0 + +This release tightens JSON5 support and adds helpful utility features: + +- New: Support hexadecimal numbers. (Thanks [@MaxNanasy].) + +- Fix: Reject octal numbers properly now. Previously, they were accepted but + improperly parsed as base-10 numbers. (Thanks [@MaxNanasy].) + +- **Breaking:** Reject "noctal" numbers now (base-10 numbers that begin with a + leading zero). These are disallowed by both JSON5 and JSON, as well as by + ES5's strict mode. (Thanks [@MaxNanasy].) + +- New: Support leading decimal points in decimal numbers. + (Thanks [@MaxNanasy].) + +- **Breaking:** Reject trailing decimal points in decimal numbers now. These + are disallowed by both JSON5 and JSON. (Thanks [@MaxNanasy].) + +- **Breaking:** Reject omitted elements in arrays now. These are disallowed by + both JSON5 and JSON. + +- Fix: Throw proper `SyntaxError` instances on errors now. + +- New: Add Node.js `require()` hook. Register via `json5/lib/require`. + +- New: Add Node.js `json5` executable to compile JSON5 files to JSON. + + +### v0.0.1 [[code][c0.0.1], [diff][d0.0.1]] + +[c0.0.1]: https://github.com/aseemk/json5/tree/v0.0.1 +[d0.0.1]: https://github.com/aseemk/json5/compare/v0.0.0...v0.0.1 + +This was the first implementation of this JSON5 parser. + +- Support unquoted object keys, including reserved words. Unicode characters + and escape sequences sequences aren't yet supported. + +- Support single-quoted strings. + +- Support multi-line strings. + +- Support trailing commas in arrays and objects. + +- Support comments, both inline and block. + + +### v0.0.0 [[code](https://github.com/aseemk/json5/tree/v0.0.0)] + +Let's consider this to be Douglas Crockford's original [json_parse.js] — a +parser for the regular JSON format. + + +[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js +[v8-hex-fix]: http://code.google.com/p/v8/issues/detail?id=2240 + +[@MaxNanasy]: https://github.com/MaxNanasy +[@Midar]: https://github.com/Midar +[@pepkin88]: https://github.com/pepkin88 +[@rowanhill]: https://github.com/rowanhill +[@aeisenberg]: https://github.com/aeisenberg +[@jordanbtucker]: https://github.com/jordanbtucker +[@amb26]: https://github.com/amb26 + +[#16]: https://github.com/aseemk/json5/issues/16 +[#24]: https://github.com/aseemk/json5/issues/24 +[#30]: https://github.com/aseemk/json5/issues/30 +[#32]: https://github.com/aseemk/json5/issues/32 +[#36]: https://github.com/aseemk/json5/issues/36 +[#57]: https://github.com/aseemk/json5/issues/57 +[#58]: https://github.com/aseemk/json5/pull/58 +[#60]: https://github.com/aseemk/json5/pull/60 +[#63]: https://github.com/aseemk/json5/pull/63 +[#97]: https://github.com/aseemk/json5/pull/97 +[#101]: https://github.com/aseemk/json5/pull/101 diff --git a/node_modules/json5/LICENSE.md b/node_modules/json5/LICENSE.md new file mode 100644 index 00000000..861df26e --- /dev/null +++ b/node_modules/json5/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012-2016 Aseem Kishore, and [others](https://github.com/aseemk/json5/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/json5/README.md b/node_modules/json5/README.md new file mode 100644 index 00000000..a4285148 --- /dev/null +++ b/node_modules/json5/README.md @@ -0,0 +1,286 @@ +# JSON5 – Modern JSON + +[![Build Status](https://travis-ci.org/json5/json5.svg)](https://travis-ci.org/json5/json5) + +JSON is an excellent data format, but we think it can be better. + +**JSON5 is a proposed extension to JSON** that aims to make it easier for +*humans to write and maintain* by hand. It does this by adding some minimal +syntax features directly from ECMAScript 5. + +JSON5 remains a **strict subset of JavaScript**, adds **no new data types**, +and **works with all existing JSON content**. + +JSON5 is *not* an official successor to JSON, and JSON5 content may *not* +work with existing JSON parsers. For this reason, JSON5 files use a new .json5 +extension. *(TODO: new MIME type needed too.)* + +The code here is a **reference JavaScript implementation** for both Node.js +and all browsers. It’s based directly off of Douglas Crockford’s own [JSON +implementation][json_parse.js], and it’s both robust and secure. + + +## Why + +JSON isn’t the friendliest to *write*. Keys need to be quoted, objects and +arrays can’t have trailing commas, and comments aren’t allowed — even though +none of these are the case with regular JavaScript today. + +That was fine when JSON’s goal was to be a great data format, but JSON’s usage +has expanded beyond *machines*. JSON is now used for writing [configs][ex1], +[manifests][ex2], even [tests][ex3] — all by *humans*. + +[ex1]: http://plovr.com/docs.html +[ex2]: https://www.npmjs.org/doc/files/package.json.html +[ex3]: http://code.google.com/p/fuzztester/wiki/JSONFileFormat + +There are other formats that are human-friendlier, like YAML, but changing +from JSON to a completely different format is undesirable in many cases. +JSON5’s aim is to remain close to JSON and JavaScript. + + +## Features + +The following is the exact list of additions to JSON’s syntax introduced by +JSON5. **All of these are optional**, and **all of these come from ES5**. + +### Objects + +- Object keys can be unquoted if they’re valid [identifiers][mdn_variables]. + Yes, even reserved keywords (like `default`) are valid unquoted keys in ES5 + [[§11.1.5](http://es5.github.com/#x11.1.5), [§7.6](http://es5.github.com/#x7.6)]. + ([More info](https://mathiasbynens.be/notes/javascript-identifiers)) + + *(TODO: Unicode characters and escape sequences aren’t yet supported in this + implementation.)* + +- Object keys can also be single-quoted. + +- Objects can have trailing commas. + +[mdn_variables]: https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables + +### Arrays + +- Arrays can have trailing commas. + +### Strings + +- Strings can be single-quoted. + +- Strings can be split across multiple lines; just prefix each newline with a + backslash. [ES5 [§7.8.4](http://es5.github.com/#x7.8.4)] + +### Numbers + +- Numbers can be hexadecimal (base 16). + +- Numbers can begin or end with a (leading or trailing) decimal point. + +- Numbers can include `Infinity`, `-Infinity`, `NaN`, and `-NaN`. + +- Numbers can begin with an explicit plus sign. + +### Comments + +- Both inline (single-line) and block (multi-line) comments are allowed. + + +## Example + +The following is a contrived example, but it illustrates most of the features: + +```js +{ + foo: 'bar', + while: true, + + this: 'is a \ +multi-line string', + + // this is an inline comment + here: 'is another', // inline comment + + /* this is a block comment + that continues on another line */ + + hex: 0xDEADbeef, + half: .5, + delta: +10, + to: Infinity, // and beyond! + + finally: 'a trailing comma', + oh: [ + "we shouldn't forget", + 'arrays can have', + 'trailing commas too', + ], +} +``` + +This implementation’s own [package.json5](package.json5) is more realistic: + +```js +// This file is written in JSON5 syntax, naturally, but npm needs a regular +// JSON file, so compile via `npm run build`. Be sure to keep both in sync! + +{ + name: 'json5', + version: '0.5.0', + description: 'JSON for the ES5 era.', + keywords: ['json', 'es5'], + author: 'Aseem Kishore ', + contributors: [ + // TODO: Should we remove this section in favor of GitHub's list? + // https://github.com/aseemk/json5/contributors + 'Max Nanasy ', + 'Andrew Eisenberg ', + 'Jordan Tucker ', + ], + main: 'lib/json5.js', + bin: 'lib/cli.js', + files: ["lib/"], + dependencies: {}, + devDependencies: { + gulp: "^3.9.1", + 'gulp-jshint': "^2.0.0", + jshint: "^2.9.1", + 'jshint-stylish': "^2.1.0", + mocha: "^2.4.5" + }, + scripts: { + build: 'node ./lib/cli.js -c package.json5', + test: 'mocha --ui exports --reporter spec', + // TODO: Would it be better to define these in a mocha.opts file? + }, + homepage: 'http://json5.org/', + license: 'MIT', + repository: { + type: 'git', + url: 'https://github.com/aseemk/json5.git', + }, +} +``` + + +## Community + +Join the [Google Group](http://groups.google.com/group/json5) if you’re +interested in JSON5 news, updates, and general discussion. +Don’t worry, it’s very low-traffic. + +The [GitHub wiki](https://github.com/aseemk/json5/wiki) is a good place to track +JSON5 support and usage. Contribute freely there! + +[GitHub Issues](https://github.com/aseemk/json5/issues) is the place to +formally propose feature requests and report bugs. Questions and general +feedback are better directed at the Google Group. + + +## Usage + +This JavaScript implementation of JSON5 simply provides a `JSON5` object just +like the native ES5 `JSON` object. + +To use from Node: + +```sh +npm install json5 +``` + +```js +var JSON5 = require('json5'); +``` + +To use in the browser (adds the `JSON5` object to the global namespace): + +```html + +``` + +Then in both cases, you can simply replace native `JSON` calls with `JSON5`: + +```js +var obj = JSON5.parse('{unquoted:"key",trailing:"comma",}'); +var str = JSON5.stringify(obj); +``` + +`JSON5.parse` supports all of the JSON5 features listed above (*TODO: except +Unicode*), as well as the native [`reviver` argument][json-parse]. + +[json-parse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse + +`JSON5.stringify` mainly avoids quoting keys where possible, but we hope to +keep expanding it in the future (e.g. to also output trailing commas). +It supports the native [`replacer` and `space` arguments][json-stringify], +as well. *(TODO: Any implemented `toJSON` methods aren’t used today.)* + +[json-stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify + + +### Extras + +If you’re running this on Node, you can also register a JSON5 `require()` hook +to let you `require()` `.json5` files just like you can `.json` files: + +```js +require('json5/lib/require'); +require('./path/to/foo'); // tries foo.json5 after foo.js, foo.json, etc. +require('./path/to/bar.json5'); +``` + +This module also provides a `json5` executable (requires Node) for converting +JSON5 files to JSON: + +```sh +json5 -c path/to/foo.json5 # generates path/to/foo.json +``` + + +## Development + +```sh +git clone git://github.com/aseemk/json5.git +cd json5 +npm install +npm test +``` + +As the `package.json5` file states, be sure to run `npm run build` on changes +to `package.json5`, since npm requires `package.json`. + +Feel free to [file issues](https://github.com/aseemk/json5/issues) and submit +[pull requests](https://github.com/aseemk/json5/pulls) — contributions are +welcome. If you do submit a pull request, please be sure to add or update the +tests, and ensure that `npm test` continues to pass. + + +## License + +MIT. See [LICENSE.md](./LICENSE.md) for details. + + +## Credits + +[Michael Bolin](http://bolinfest.com/) independently arrived at and published +some of these same ideas with awesome explanations and detail. +Recommended reading: +[Suggested Improvements to JSON](http://bolinfest.com/essays/json.html) + +[Douglas Crockford](http://www.crockford.com/) of course designed and built +JSON, but his state machine diagrams on the [JSON website](http://json.org/), +as cheesy as it may sound, gave me motivation and confidence that building a +new parser to implement these ideas this was within my reach! +This code is also modeled directly off of Doug’s open-source [json_parse.js][] +parser. I’m super grateful for that clean and well-documented code. + +[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js + +[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific +supporter, contributing multiple patches and ideas. Thanks Max! + +[Andrew Eisenberg](https://github.com/aeisenberg) has contributed the +`stringify` method. + +[Jordan Tucker](https://github.com/jordanbtucker) has aligned JSON5 more closely +with ES5 and is actively maintaining this project. diff --git a/node_modules/json5/lib/cli.js b/node_modules/json5/lib/cli.js new file mode 100755 index 00000000..9b72f6d1 --- /dev/null +++ b/node_modules/json5/lib/cli.js @@ -0,0 +1,41 @@ +#!/usr/bin/env node + +// cli.js +// JSON5 command-line interface. +// +// This is pretty minimal for now; just supports compiling files via `-c`. +// TODO More useful functionality, like output path, watch, etc.? + +var FS = require('fs'); +var JSON5 = require('./json5'); +var Path = require('path'); + +var USAGE = [ + 'Usage: json5 -c path/to/file.json5 ...', + 'Compiles JSON5 files into sibling JSON files with the same basenames.', +].join('\n'); + +// if valid, args look like [node, json5, -c, file1, file2, ...] +var args = process.argv; + +if (args.length < 4 || args[2] !== '-c') { + console.error(USAGE); + process.exit(1); +} + +var cwd = process.cwd(); +var files = args.slice(3); + +// iterate over each file and convert JSON5 files to JSON: +files.forEach(function (file) { + var path = Path.resolve(cwd, file); + var basename = Path.basename(path, '.json5'); + var dirname = Path.dirname(path); + + var json5 = FS.readFileSync(path, 'utf8'); + var obj = JSON5.parse(json5); + var json = JSON.stringify(obj, null, 4); // 4 spaces; TODO configurable? + + path = Path.join(dirname, basename + '.json'); + FS.writeFileSync(path, json, 'utf8'); +}); diff --git a/node_modules/json5/lib/json5.js b/node_modules/json5/lib/json5.js new file mode 100644 index 00000000..4a4590d0 --- /dev/null +++ b/node_modules/json5/lib/json5.js @@ -0,0 +1,770 @@ +// json5.js +// Modern JSON. See README.md for details. +// +// This file is based directly off of Douglas Crockford's json_parse.js: +// https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js + +var JSON5 = (typeof exports === 'object' ? exports : {}); + +JSON5.parse = (function () { + "use strict"; + +// This is a function that can parse a JSON5 text, producing a JavaScript +// data structure. It is a simple, recursive descent parser. It does not use +// eval or regular expressions, so it can be used as a model for implementing +// a JSON5 parser in other languages. + +// We are defining the function inside of another function to avoid creating +// global variables. + + var at, // The index of the current character + lineNumber, // The current line number + columnNumber, // The current column number + ch, // The current character + escapee = { + "'": "'", + '"': '"', + '\\': '\\', + '/': '/', + '\n': '', // Replace escaped newlines in strings w/ empty string + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t' + }, + ws = [ + ' ', + '\t', + '\r', + '\n', + '\v', + '\f', + '\xA0', + '\uFEFF' + ], + text, + + renderChar = function (chr) { + return chr === '' ? 'EOF' : "'" + chr + "'"; + }, + + error = function (m) { + +// Call error when something is wrong. + + var error = new SyntaxError(); + // beginning of message suffix to agree with that provided by Gecko - see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse + error.message = m + " at line " + lineNumber + " column " + columnNumber + " of the JSON5 data. Still to read: " + JSON.stringify(text.substring(at - 1, at + 19)); + error.at = at; + // These two property names have been chosen to agree with the ones in Gecko, the only popular + // environment which seems to supply this info on JSON.parse + error.lineNumber = lineNumber; + error.columnNumber = columnNumber; + throw error; + }, + + next = function (c) { + +// If a c parameter is provided, verify that it matches the current character. + + if (c && c !== ch) { + error("Expected " + renderChar(c) + " instead of " + renderChar(ch)); + } + +// Get the next character. When there are no more characters, +// return the empty string. + + ch = text.charAt(at); + at++; + columnNumber++; + if (ch === '\n' || ch === '\r' && peek() !== '\n') { + lineNumber++; + columnNumber = 0; + } + return ch; + }, + + peek = function () { + +// Get the next character without consuming it or +// assigning it to the ch varaible. + + return text.charAt(at); + }, + + identifier = function () { + +// Parse an identifier. Normally, reserved words are disallowed here, but we +// only use this for unquoted object keys, where reserved words are allowed, +// so we don't check for those here. References: +// - http://es5.github.com/#x7.6 +// - https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables +// - http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm +// TODO Identifiers can have Unicode "letters" in them; add support for those. + + var key = ch; + + // Identifiers must start with a letter, _ or $. + if ((ch !== '_' && ch !== '$') && + (ch < 'a' || ch > 'z') && + (ch < 'A' || ch > 'Z')) { + error("Bad identifier as unquoted key"); + } + + // Subsequent characters can contain digits. + while (next() && ( + ch === '_' || ch === '$' || + (ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >= '0' && ch <= '9'))) { + key += ch; + } + + return key; + }, + + number = function () { + +// Parse a number value. + + var number, + sign = '', + string = '', + base = 10; + + if (ch === '-' || ch === '+') { + sign = ch; + next(ch); + } + + // support for Infinity (could tweak to allow other words): + if (ch === 'I') { + number = word(); + if (typeof number !== 'number' || isNaN(number)) { + error('Unexpected word for number'); + } + return (sign === '-') ? -number : number; + } + + // support for NaN + if (ch === 'N' ) { + number = word(); + if (!isNaN(number)) { + error('expected word to be NaN'); + } + // ignore sign as -NaN also is NaN + return number; + } + + if (ch === '0') { + string += ch; + next(); + if (ch === 'x' || ch === 'X') { + string += ch; + next(); + base = 16; + } else if (ch >= '0' && ch <= '9') { + error('Octal literal'); + } + } + + switch (base) { + case 10: + while (ch >= '0' && ch <= '9' ) { + string += ch; + next(); + } + if (ch === '.') { + string += '.'; + while (next() && ch >= '0' && ch <= '9') { + string += ch; + } + } + if (ch === 'e' || ch === 'E') { + string += ch; + next(); + if (ch === '-' || ch === '+') { + string += ch; + next(); + } + while (ch >= '0' && ch <= '9') { + string += ch; + next(); + } + } + break; + case 16: + while (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') { + string += ch; + next(); + } + break; + } + + if(sign === '-') { + number = -string; + } else { + number = +string; + } + + if (!isFinite(number)) { + error("Bad number"); + } else { + return number; + } + }, + + string = function () { + +// Parse a string value. + + var hex, + i, + string = '', + delim, // double quote or single quote + uffff; + +// When parsing for string values, we must look for ' or " and \ characters. + + if (ch === '"' || ch === "'") { + delim = ch; + while (next()) { + if (ch === delim) { + next(); + return string; + } else if (ch === '\\') { + next(); + if (ch === 'u') { + uffff = 0; + for (i = 0; i < 4; i += 1) { + hex = parseInt(next(), 16); + if (!isFinite(hex)) { + break; + } + uffff = uffff * 16 + hex; + } + string += String.fromCharCode(uffff); + } else if (ch === '\r') { + if (peek() === '\n') { + next(); + } + } else if (typeof escapee[ch] === 'string') { + string += escapee[ch]; + } else { + break; + } + } else if (ch === '\n') { + // unescaped newlines are invalid; see: + // https://github.com/aseemk/json5/issues/24 + // TODO this feels special-cased; are there other + // invalid unescaped chars? + break; + } else { + string += ch; + } + } + } + error("Bad string"); + }, + + inlineComment = function () { + +// Skip an inline comment, assuming this is one. The current character should +// be the second / character in the // pair that begins this inline comment. +// To finish the inline comment, we look for a newline or the end of the text. + + if (ch !== '/') { + error("Not an inline comment"); + } + + do { + next(); + if (ch === '\n' || ch === '\r') { + next(); + return; + } + } while (ch); + }, + + blockComment = function () { + +// Skip a block comment, assuming this is one. The current character should be +// the * character in the /* pair that begins this block comment. +// To finish the block comment, we look for an ending */ pair of characters, +// but we also watch for the end of text before the comment is terminated. + + if (ch !== '*') { + error("Not a block comment"); + } + + do { + next(); + while (ch === '*') { + next('*'); + if (ch === '/') { + next('/'); + return; + } + } + } while (ch); + + error("Unterminated block comment"); + }, + + comment = function () { + +// Skip a comment, whether inline or block-level, assuming this is one. +// Comments always begin with a / character. + + if (ch !== '/') { + error("Not a comment"); + } + + next('/'); + + if (ch === '/') { + inlineComment(); + } else if (ch === '*') { + blockComment(); + } else { + error("Unrecognized comment"); + } + }, + + white = function () { + +// Skip whitespace and comments. +// Note that we're detecting comments by only a single / character. +// This works since regular expressions are not valid JSON(5), but this will +// break if there are other valid values that begin with a / character! + + while (ch) { + if (ch === '/') { + comment(); + } else if (ws.indexOf(ch) >= 0) { + next(); + } else { + return; + } + } + }, + + word = function () { + +// true, false, or null. + + switch (ch) { + case 't': + next('t'); + next('r'); + next('u'); + next('e'); + return true; + case 'f': + next('f'); + next('a'); + next('l'); + next('s'); + next('e'); + return false; + case 'n': + next('n'); + next('u'); + next('l'); + next('l'); + return null; + case 'I': + next('I'); + next('n'); + next('f'); + next('i'); + next('n'); + next('i'); + next('t'); + next('y'); + return Infinity; + case 'N': + next( 'N' ); + next( 'a' ); + next( 'N' ); + return NaN; + } + error("Unexpected " + renderChar(ch)); + }, + + value, // Place holder for the value function. + + array = function () { + +// Parse an array value. + + var array = []; + + if (ch === '[') { + next('['); + white(); + while (ch) { + if (ch === ']') { + next(']'); + return array; // Potentially empty array + } + // ES5 allows omitting elements in arrays, e.g. [,] and + // [,null]. We don't allow this in JSON5. + if (ch === ',') { + error("Missing array element"); + } else { + array.push(value()); + } + white(); + // If there's no comma after this value, this needs to + // be the end of the array. + if (ch !== ',') { + next(']'); + return array; + } + next(','); + white(); + } + } + error("Bad array"); + }, + + object = function () { + +// Parse an object value. + + var key, + object = {}; + + if (ch === '{') { + next('{'); + white(); + while (ch) { + if (ch === '}') { + next('}'); + return object; // Potentially empty object + } + + // Keys can be unquoted. If they are, they need to be + // valid JS identifiers. + if (ch === '"' || ch === "'") { + key = string(); + } else { + key = identifier(); + } + + white(); + next(':'); + object[key] = value(); + white(); + // If there's no comma after this pair, this needs to be + // the end of the object. + if (ch !== ',') { + next('}'); + return object; + } + next(','); + white(); + } + } + error("Bad object"); + }; + + value = function () { + +// Parse a JSON value. It could be an object, an array, a string, a number, +// or a word. + + white(); + switch (ch) { + case '{': + return object(); + case '[': + return array(); + case '"': + case "'": + return string(); + case '-': + case '+': + case '.': + return number(); + default: + return ch >= '0' && ch <= '9' ? number() : word(); + } + }; + +// Return the json_parse function. It will have access to all of the above +// functions and variables. + + return function (source, reviver) { + var result; + + text = String(source); + at = 0; + lineNumber = 1; + columnNumber = 1; + ch = ' '; + result = value(); + white(); + if (ch) { + error("Syntax error"); + } + +// If there is a reviver function, we recursively walk the new structure, +// passing each name/value pair to the reviver function for possible +// transformation, starting with a temporary root object that holds the result +// in an empty key. If there is not a reviver function, we simply return the +// result. + + return typeof reviver === 'function' ? (function walk(holder, key) { + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + }({'': result}, '')) : result; + }; +}()); + +// JSON5 stringify will not quote keys where appropriate +JSON5.stringify = function (obj, replacer, space) { + if (replacer && (typeof(replacer) !== "function" && !isArray(replacer))) { + throw new Error('Replacer must be a function or an array'); + } + var getReplacedValueOrUndefined = function(holder, key, isTopLevel) { + var value = holder[key]; + + // Replace the value with its toJSON value first, if possible + if (value && value.toJSON && typeof value.toJSON === "function") { + value = value.toJSON(); + } + + // If the user-supplied replacer if a function, call it. If it's an array, check objects' string keys for + // presence in the array (removing the key/value pair from the resulting JSON if the key is missing). + if (typeof(replacer) === "function") { + return replacer.call(holder, key, value); + } else if(replacer) { + if (isTopLevel || isArray(holder) || replacer.indexOf(key) >= 0) { + return value; + } else { + return undefined; + } + } else { + return value; + } + }; + + function isWordChar(c) { + return (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c === '_' || c === '$'; + } + + function isWordStart(c) { + return (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + c === '_' || c === '$'; + } + + function isWord(key) { + if (typeof key !== 'string') { + return false; + } + if (!isWordStart(key[0])) { + return false; + } + var i = 1, length = key.length; + while (i < length) { + if (!isWordChar(key[i])) { + return false; + } + i++; + } + return true; + } + + // export for use in tests + JSON5.isWord = isWord; + + // polyfills + function isArray(obj) { + if (Array.isArray) { + return Array.isArray(obj); + } else { + return Object.prototype.toString.call(obj) === '[object Array]'; + } + } + + function isDate(obj) { + return Object.prototype.toString.call(obj) === '[object Date]'; + } + + var objStack = []; + function checkForCircular(obj) { + for (var i = 0; i < objStack.length; i++) { + if (objStack[i] === obj) { + throw new TypeError("Converting circular structure to JSON"); + } + } + } + + function makeIndent(str, num, noNewLine) { + if (!str) { + return ""; + } + // indentation no more than 10 chars + if (str.length > 10) { + str = str.substring(0, 10); + } + + var indent = noNewLine ? "" : "\n"; + for (var i = 0; i < num; i++) { + indent += str; + } + + return indent; + } + + var indentStr; + if (space) { + if (typeof space === "string") { + indentStr = space; + } else if (typeof space === "number" && space >= 0) { + indentStr = makeIndent(" ", space, true); + } else { + // ignore space parameter + } + } + + // Copied from Crokford's implementation of JSON + // See https://github.com/douglascrockford/JSON-js/blob/e39db4b7e6249f04a195e7dd0840e610cc9e941e/json2.js#L195 + // Begin + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }; + function escapeString(string) { + +// If the string contains no control characters, no quote characters, and no +// backslash characters, then we can safely slap some quotes around it. +// Otherwise we must also replace the offending characters with safe escape +// sequences. + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? + c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; + } + // End + + function internalStringify(holder, key, isTopLevel) { + var buffer, res; + + // Replace the value, if necessary + var obj_part = getReplacedValueOrUndefined(holder, key, isTopLevel); + + if (obj_part && !isDate(obj_part)) { + // unbox objects + // don't unbox dates, since will turn it into number + obj_part = obj_part.valueOf(); + } + switch(typeof obj_part) { + case "boolean": + return obj_part.toString(); + + case "number": + if (isNaN(obj_part) || !isFinite(obj_part)) { + return "null"; + } + return obj_part.toString(); + + case "string": + return escapeString(obj_part.toString()); + + case "object": + if (obj_part === null) { + return "null"; + } else if (isArray(obj_part)) { + checkForCircular(obj_part); + buffer = "["; + objStack.push(obj_part); + + for (var i = 0; i < obj_part.length; i++) { + res = internalStringify(obj_part, i, false); + buffer += makeIndent(indentStr, objStack.length); + if (res === null || typeof res === "undefined") { + buffer += "null"; + } else { + buffer += res; + } + if (i < obj_part.length-1) { + buffer += ","; + } else if (indentStr) { + buffer += "\n"; + } + } + objStack.pop(); + if (obj_part.length) { + buffer += makeIndent(indentStr, objStack.length, true) + } + buffer += "]"; + } else { + checkForCircular(obj_part); + buffer = "{"; + var nonEmpty = false; + objStack.push(obj_part); + for (var prop in obj_part) { + if (obj_part.hasOwnProperty(prop)) { + var value = internalStringify(obj_part, prop, false); + isTopLevel = false; + if (typeof value !== "undefined" && value !== null) { + buffer += makeIndent(indentStr, objStack.length); + nonEmpty = true; + key = isWord(prop) ? prop : escapeString(prop); + buffer += key + ":" + (indentStr ? ' ' : '') + value + ","; + } + } + } + objStack.pop(); + if (nonEmpty) { + buffer = buffer.substring(0, buffer.length-1) + makeIndent(indentStr, objStack.length) + "}"; + } else { + buffer = '{}'; + } + } + return buffer; + default: + // functions and undefined should be ignored + return undefined; + } + } + + // special case...when undefined is used inside of + // a compound object/array, return null. + // but when top-level, return undefined + var topLevelHolder = {"":obj}; + if (obj === undefined) { + return getReplacedValueOrUndefined(topLevelHolder, '', true); + } + return internalStringify(topLevelHolder, '', true); +}; diff --git a/node_modules/json5/lib/require.js b/node_modules/json5/lib/require.js new file mode 100644 index 00000000..73e56fe9 --- /dev/null +++ b/node_modules/json5/lib/require.js @@ -0,0 +1,18 @@ +// require.js +// Node.js only: adds a require() hook for .json5 files, just like the native +// hook for .json files. +// +// Usage: +// require('json5/require'); +// require('./foo'); // will check foo.json5 after foo.js, foo.json, etc. +// require('./bar.json5'); + +var FS = require('fs'); +var JSON5 = require('./json5'); + +// Modeled off of (v0.6.18 link; check latest too): +// https://github.com/joyent/node/blob/v0.6.18/lib/module.js#L468-L472 +require.extensions['.json5'] = function (module, filename) { + var content = FS.readFileSync(filename, 'utf8'); + module.exports = JSON5.parse(content); +}; diff --git a/node_modules/json5/package.json b/node_modules/json5/package.json new file mode 100644 index 00000000..aa7843f4 --- /dev/null +++ b/node_modules/json5/package.json @@ -0,0 +1,80 @@ +{ + "_from": "json5@^0.5.1", + "_id": "json5@0.5.1", + "_inBundle": false, + "_integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "_location": "/json5", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "json5@^0.5.1", + "name": "json5", + "escapedName": "json5", + "rawSpec": "^0.5.1", + "saveSpec": null, + "fetchSpec": "^0.5.1" + }, + "_requiredBy": [ + "/unified-args" + ], + "_resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "_shasum": "1eade7acc012034ad84e2396767ead9fa5495821", + "_spec": "json5@^0.5.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-args", + "author": { + "name": "Aseem Kishore", + "email": "aseem.kishore@gmail.com" + }, + "bin": { + "json5": "lib/cli.js" + }, + "bugs": { + "url": "https://github.com/aseemk/json5/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Max Nanasy", + "email": "max.nanasy@gmail.com" + }, + { + "name": "Andrew Eisenberg", + "email": "andrew@eisenberg.as" + }, + { + "name": "Jordan Tucker", + "email": "jordanbtucker@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "JSON for the ES5 era.", + "devDependencies": { + "gulp": "^3.9.1", + "gulp-jshint": "^2.0.1", + "jshint": "^2.9.3", + "jshint-stylish": "^2.2.1", + "mocha": "^3.1.0" + }, + "files": [ + "lib/" + ], + "homepage": "http://json5.org/", + "keywords": [ + "json", + "es5" + ], + "license": "MIT", + "main": "lib/json5.js", + "name": "json5", + "repository": { + "type": "git", + "url": "git+https://github.com/aseemk/json5.git" + }, + "scripts": { + "build": "node ./lib/cli.js -c package.json5", + "test": "mocha --ui exports --reporter spec" + }, + "version": "0.5.1" +} diff --git a/node_modules/kind-of/LICENSE b/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..d734237b --- /dev/null +++ b/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/kind-of/README.md b/node_modules/kind-of/README.md new file mode 100644 index 00000000..6a9df36d --- /dev/null +++ b/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/kind-of/index.js b/node_modules/kind-of/index.js new file mode 100644 index 00000000..b52c2917 --- /dev/null +++ b/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/kind-of/package.json b/node_modules/kind-of/package.json new file mode 100644 index 00000000..162401b4 --- /dev/null +++ b/node_modules/kind-of/package.json @@ -0,0 +1,146 @@ +{ + "_from": "kind-of@^3.0.2", + "_id": "kind-of@3.2.2", + "_inBundle": false, + "_integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "_location": "/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": [ + "/is-accessor-descriptor", + "/is-data-descriptor", + "/is-number", + "/micromatch", + "/object-copy", + "/snapdragon-util", + "/to-object-path", + "/to-regex-range/is-number" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "_shasum": "31ea21a734bab9bbb0f32466d893aea51e4a3c64", + "_spec": "kind-of@^3.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/micromatch", + "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/load-plugin/browser.js b/node_modules/load-plugin/browser.js new file mode 100644 index 00000000..6f758495 --- /dev/null +++ b/node_modules/load-plugin/browser.js @@ -0,0 +1,12 @@ +'use strict' + +module.exports = loadPlugin +loadPlugin.resolve = resolvePlugin + +function loadPlugin() { + throw new Error('Cannot require plugins in the browser') +} + +function resolvePlugin() { + throw new Error('Cannot resolve plugins in the browser') +} diff --git a/node_modules/load-plugin/index.js b/node_modules/load-plugin/index.js new file mode 100644 index 00000000..748424ce --- /dev/null +++ b/node_modules/load-plugin/index.js @@ -0,0 +1,112 @@ +'use strict' + +var fs = require('fs') +var path = require('path') +var resolve = require('resolve-from').silent +var npmPrefix = require('npm-prefix')() + +module.exports = loadPlugin +loadPlugin.resolve = resolvePlugin + +var electron = process.versions.electron !== undefined +var argv = process.argv[1] || /* istanbul ignore next */ '' +var nvm = process.env.NVM_BIN +var globally = electron || argv.indexOf(npmPrefix) === 0 +var windows = process.platform === 'win32' +var prefix = windows ? /* istanbul ignore next */ '' : 'lib' +var globals = path.resolve(npmPrefix, prefix, 'node_modules') + +// If we’re in Electron, we’re running in a modified Node that cannot really +// install global node modules. To find the actual modules, the user has to +// either set `prefix` in their `.npmrc` (which is picked up by `npm-prefix`). +// Most people don’t do that, and some use NVM instead to manage different +// versions of Node. Luckily NVM leaks some environment variables that we can +// pick up on to try and detect the actual modules. +/* istanbul ignore next */ +if (electron && nvm && !fs.existsSync(globals)) { + globals = path.resolve(nvm, '..', prefix, 'node_modules') +} + +// Load the plug-in found using `resolvePlugin`. +function loadPlugin(name, options) { + return require(resolvePlugin(name, options) || name) +} + +// Find a plugin. +// +// See also: +// +// +// +// Uses the standard node module loading strategy to find $name in each given +// `cwd` (and optionally the global `node_modules` directory). +// +// If a prefix is given and $name is not a path, `$prefix-$name` is also +// searched (preferring these over non-prefixed modules). +function resolvePlugin(name, options) { + var settings = options || {} + var prefix = settings.prefix + var cwd = settings.cwd + var global = settings.global + var filePath + var sources + var length + var index + var plugin + var slash + var scope = '' + + if (global === null || global === undefined) { + global = globally + } + + if (cwd && typeof cwd === 'object') { + sources = cwd.concat() + } else { + sources = [cwd || process.cwd()] + } + + // Non-path. + if (name.charAt(0) !== '.') { + if (global) { + sources.push(globals) + } + + // Unprefix module. + if (prefix) { + prefix = prefix.charAt(prefix.length - 1) === '-' ? prefix : prefix + '-' + + // Scope? + if (name.charAt(0) === '@') { + slash = name.indexOf('/') + + // Let’s keep the algorithm simple. No need to care if this is a + // “valid” scope (I think?). But we do check for the slash. + if (slash !== -1) { + scope = name.slice(0, slash + 1) + name = name.slice(slash + 1) + } + } + + if (name.slice(0, prefix.length) !== prefix) { + plugin = scope + prefix + name + } + + name = scope + name + } + } + + length = sources.length + index = -1 + + while (++index < length) { + cwd = sources[index] + filePath = (plugin && resolve(cwd, plugin)) || resolve(cwd, name) + + if (filePath) { + return filePath + } + } + + return null +} diff --git a/node_modules/load-plugin/license b/node_modules/load-plugin/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/load-plugin/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/load-plugin/package.json b/node_modules/load-plugin/package.json new file mode 100644 index 00000000..23c52862 --- /dev/null +++ b/node_modules/load-plugin/package.json @@ -0,0 +1,105 @@ +{ + "_from": "load-plugin@^2.0.0", + "_id": "load-plugin@2.3.1", + "_inBundle": false, + "_integrity": "sha512-dYB1lbwqHgPTrruy9glukCu8Ya9vzj6TMfouCtj2H/GuJ+8syioisgKTBPxnCi6m8K8jINKfTOxOHngFkUYqHw==", + "_location": "/load-plugin", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "load-plugin@^2.0.0", + "name": "load-plugin", + "escapedName": "load-plugin", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/unified-engine" + ], + "_resolved": "https://registry.npmjs.org/load-plugin/-/load-plugin-2.3.1.tgz", + "_shasum": "8024739afb4aa04de1e602e15e5b1a678c443d00", + "_spec": "load-plugin@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-engine", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/wooorm/load-plugin/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "npm-prefix": "^1.2.0", + "resolve-from": "^5.0.0" + }, + "deprecated": false, + "description": "Load a submodule, plugin, or file", + "devDependencies": { + "nyc": "^14.0.0", + "prettier": "^1.12.0", + "remark-cli": "^6.0.0", + "remark-lint": "^6.0.0", + "remark-preset-wooorm": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.24.0" + }, + "files": [ + "browser", + "index.js" + ], + "homepage": "https://github.com/wooorm/load-plugin#readme", + "keywords": [ + "load", + "submodule", + "package", + "plugin" + ], + "license": "MIT", + "main": "index.js", + "name": "load-plugin", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/load-plugin.git" + }, + "scripts": { + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test/index.js" + }, + "version": "2.3.1", + "xo": { + "prettier": true, + "esnext": false + } +} diff --git a/node_modules/load-plugin/readme.md b/node_modules/load-plugin/readme.md new file mode 100644 index 00000000..defeed56 --- /dev/null +++ b/node_modules/load-plugin/readme.md @@ -0,0 +1,126 @@ +# load-plugin + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] + +Load a submodule, plugin, or file. +Like Node’s `require` and `require.resolve`, but from one or more places, and +optionally global too. + +## Installation + +[npm][]: + +```bash +npm install load-plugin +``` + +When bundled for the browser, a small [file][browser] is included to warn that, +when any of the below functions are invoked, the action is unsupported. + +## Usage + +Say we’re in this project (with dependencies installed): + +```javascript +var load = require('load-plugin') + +load.resolve('lint', {prefix: 'remark'}) +// => '/Users/tilde/projects/oss/load-plugin/node_modules/remark-lint/index.js' + +load.resolve('@babel/function-name', {prefix: 'helper'}) +// => '/Users/tilde/projects/oss/load-plugin/node_modules/@babel/helper-function-name/index.js' + +load.resolve('./index.js', {prefix: 'remark'}) +// => '/Users/tilde/projects/oss/load-plugin/index.js' + +load.require('lint', {prefix: 'remark'}) +// => [Function: lint] +``` + +## API + +### `loadPlugin(name[, options])` + +Uses the standard node module loading strategy to require `name` in each given +`cwd` (and optionally the global `node_modules` directory). + +If a prefix is given and `name` is not a path, `prefix-name` is also searched +(preferring these over non-prefixed modules). +If name starts with a scope (`@scope/name`), the prefix is applied after it: +`@scope/prefix-name`. + +##### `options` + +###### `options.prefix` + +Prefix to search for (`string`, optional). + +###### `options.cwd` + +Place or places to search from (`string`, `Array.`, default: +`process.cwd()`). + +###### `options.global` + +Whether to look for `name` in [global places][global] (`boolean`, optional, +defaults to whether global is detected). +If this is nully, `load-plugin` will detect if it’s currently running in global +mode: either because it’s in Electron, or because a globally installed package +is running it. + +Note: Electron runs its own version of Node instead of your system Node. +That means global packages cannot be found, unless you’ve [set-up][] a [`prefix` +in your `.npmrc`][prefix] or are using [nvm][] to manage your system node. + +###### Returns + +The results of `require`ing the first path that exists. + +###### Throws + +If `require`ing an existing path fails, or if no existing path exists. + +### `loadPlugin.resolve(name[, options])` + +Search for `name`. +Accepts the same parameters as [`loadPlugin`][load-plugin] but returns an +absolute path for `name` instead of requiring it, and `null` if it cannot be +found. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/load-plugin.svg + +[build]: https://travis-ci.org/wooorm/load-plugin + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/load-plugin.svg + +[coverage]: https://codecov.io/github/wooorm/load-plugin + +[downloads-badge]: https://img.shields.io/npm/dm/load-plugin.svg + +[downloads]: https://www.npmjs.com/package/load-plugin + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[global]: https://docs.npmjs.com/files/folders#node-modules + +[load-plugin]: #loadpluginname-options + +[browser]: browser.js + +[prefix]: https://docs.npmjs.com/misc/config#prefix + +[set-up]: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md + +[nvm]: https://github.com/creationix/nvm diff --git a/node_modules/longest-streak/index.js b/node_modules/longest-streak/index.js new file mode 100644 index 00000000..ec579877 --- /dev/null +++ b/node_modules/longest-streak/index.js @@ -0,0 +1,36 @@ +'use strict' + +module.exports = longestStreak + +// Get the count of the longest repeating streak of `character` in `value`. +function longestStreak(value, character) { + var count = 0 + var maximum = 0 + var expected + var index + + if (typeof character !== 'string' || character.length !== 1) { + throw new Error('Expected character') + } + + value = String(value) + index = value.indexOf(character) + expected = index + + while (index !== -1) { + count++ + + if (index === expected) { + if (count > maximum) { + maximum = count + } + } else { + count = 1 + } + + expected = index + 1 + index = value.indexOf(character, expected) + } + + return maximum +} diff --git a/node_modules/longest-streak/license b/node_modules/longest-streak/license new file mode 100644 index 00000000..611b6758 --- /dev/null +++ b/node_modules/longest-streak/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/longest-streak/package.json b/node_modules/longest-streak/package.json new file mode 100644 index 00000000..35a3d8ba --- /dev/null +++ b/node_modules/longest-streak/package.json @@ -0,0 +1,112 @@ +{ + "_from": "longest-streak@^2.0.1", + "_id": "longest-streak@2.0.4", + "_inBundle": false, + "_integrity": "sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==", + "_location": "/longest-streak", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "longest-streak@^2.0.1", + "name": "longest-streak", + "escapedName": "longest-streak", + "rawSpec": "^2.0.1", + "saveSpec": null, + "fetchSpec": "^2.0.1" + }, + "_requiredBy": [ + "/remark-stringify" + ], + "_resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.4.tgz", + "_shasum": "b8599957da5b5dab64dee3fe316fa774597d90e4", + "_spec": "longest-streak@^2.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-stringify", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/longest-streak/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Count the longest repeating streak of a character", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.25.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "homepage": "https://github.com/wooorm/longest-streak#readme", + "keywords": [ + "count", + "length", + "longest", + "repeating", + "streak", + "character" + ], + "license": "MIT", + "name": "longest-streak", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/longest-streak.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s longestStreak -o longest-streak.js", + "build-mangle": "browserify . -s longestStreak -p tinyify -o longest-streak.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "2.0.4", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "longest-streak.js" + ] + } +} diff --git a/node_modules/longest-streak/readme.md b/node_modules/longest-streak/readme.md new file mode 100644 index 00000000..80dfa266 --- /dev/null +++ b/node_modules/longest-streak/readme.md @@ -0,0 +1,72 @@ +# longest-streak + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Count the longest repeating streak of a character. + +## Install + +[npm][]: + +```sh +npm install longest-streak +``` + +## Use + +```js +var longestStreak = require('longest-streak') + +longestStreak('` foo `` bar `', '`') // => 2 +``` + +## API + +### `longestStreak(value, character)` + +Get the count of the longest repeating streak of `character` in `value`. + +###### Parameters + +* `value` (`string`) — Content, coerced to string. +* `character` (`string`) — Single character to look for. + +###### Returns + +`number` — Number of characters at the place where `character` occurs in +its longest streak in `value`. + +###### Throws + +* `Error` — when `character` is not a single character string. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/longest-streak.svg + +[build]: https://travis-ci.org/wooorm/longest-streak + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/longest-streak.svg + +[coverage]: https://codecov.io/github/wooorm/longest-streak + +[downloads-badge]: https://img.shields.io/npm/dm/longest-streak.svg + +[downloads]: https://www.npmjs.com/package/longest-streak + +[size-badge]: https://img.shields.io/bundlephobia/minzip/longest-streak.svg + +[size]: https://bundlephobia.com/result?p=longest-streak + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com diff --git a/node_modules/map-cache/LICENSE b/node_modules/map-cache/LICENSE new file mode 100644 index 00000000..1e49edf8 --- /dev/null +++ b/node_modules/map-cache/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/map-cache/README.md b/node_modules/map-cache/README.md new file mode 100644 index 00000000..6260b29f --- /dev/null +++ b/node_modules/map-cache/README.md @@ -0,0 +1,145 @@ +# map-cache [![NPM version](https://img.shields.io/npm/v/map-cache.svg?style=flat)](https://www.npmjs.com/package/map-cache) [![NPM downloads](https://img.shields.io/npm/dm/map-cache.svg?style=flat)](https://npmjs.org/package/map-cache) [![Build Status](https://img.shields.io/travis/jonschlinkert/map-cache.svg?style=flat)](https://travis-ci.org/jonschlinkert/map-cache) + +Basic cache object for storing key-value pairs. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install map-cache --save +``` + +Based on MapCache in Lo-dash v3.0. [MIT License](https://github.com/lodash/lodash/blob/master/LICENSE.txt) + +## Usage + +```js +var MapCache = require('map-cache'); +var mapCache = new MapCache(); +``` + +## API + +### [MapCache](index.js#L28) + +Creates a cache object to store key/value pairs. + +**Example** + +```js +var cache = new MapCache(); +``` + +### [.set](index.js#L45) + +Adds `value` to `key` on the cache. + +**Params** + +* `key` **{String}**: The key of the value to cache. +* `value` **{any}**: The value to cache. +* `returns` **{Object}**: Returns the `Cache` object for chaining. + +**Example** + +```js +cache.set('foo', 'bar'); +``` + +### [.get](index.js#L65) + +Gets the cached value for `key`. + +**Params** + +* `key` **{String}**: The key of the value to get. +* `returns` **{any}**: Returns the cached value. + +**Example** + +```js +cache.get('foo'); +//=> 'bar' +``` + +### [.has](index.js#L82) + +Checks if a cached value for `key` exists. + +**Params** + +* `key` **{String}**: The key of the entry to check. +* `returns` **{Boolean}**: Returns `true` if an entry for `key` exists, else `false`. + +**Example** + +```js +cache.has('foo'); +//=> true +``` + +### [.del](index.js#L98) + +Removes `key` and its value from the cache. + +**Params** + +* `key` **{String}**: The key of the value to remove. +* `returns` **{Boolean}**: Returns `true` if the entry was removed successfully, else `false`. + +**Example** + +```js +cache.del('foo'); +``` + +## Related projects + +You might also be interested in these projects: + +* [cache-base](https://www.npmjs.com/package/cache-base): Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects. | [homepage](https://github.com/jonschlinkert/cache-base) +* [config-cache](https://www.npmjs.com/package/config-cache): General purpose JavaScript object storage methods. | [homepage](https://github.com/jonschlinkert/config-cache) +* [option-cache](https://www.npmjs.com/package/option-cache): Simple API for managing options in JavaScript applications. | [homepage](https://github.com/jonschlinkert/option-cache) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/map-cache/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/map-cache/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 10, 2016._ \ No newline at end of file diff --git a/node_modules/map-cache/index.js b/node_modules/map-cache/index.js new file mode 100644 index 00000000..f86842f2 --- /dev/null +++ b/node_modules/map-cache/index.js @@ -0,0 +1,100 @@ +/*! + * map-cache + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var hasOwn = Object.prototype.hasOwnProperty; + +/** + * Expose `MapCache` + */ + +module.exports = MapCache; + +/** + * Creates a cache object to store key/value pairs. + * + * ```js + * var cache = new MapCache(); + * ``` + * + * @api public + */ + +function MapCache(data) { + this.__data__ = data || {}; +} + +/** + * Adds `value` to `key` on the cache. + * + * ```js + * cache.set('foo', 'bar'); + * ``` + * + * @param {String} `key` The key of the value to cache. + * @param {*} `value` The value to cache. + * @returns {Object} Returns the `Cache` object for chaining. + * @api public + */ + +MapCache.prototype.set = function mapSet(key, value) { + if (key !== '__proto__') { + this.__data__[key] = value; + } + return this; +}; + +/** + * Gets the cached value for `key`. + * + * ```js + * cache.get('foo'); + * //=> 'bar' + * ``` + * + * @param {String} `key` The key of the value to get. + * @returns {*} Returns the cached value. + * @api public + */ + +MapCache.prototype.get = function mapGet(key) { + return key === '__proto__' ? undefined : this.__data__[key]; +}; + +/** + * Checks if a cached value for `key` exists. + * + * ```js + * cache.has('foo'); + * //=> true + * ``` + * + * @param {String} `key` The key of the entry to check. + * @returns {Boolean} Returns `true` if an entry for `key` exists, else `false`. + * @api public + */ + +MapCache.prototype.has = function mapHas(key) { + return key !== '__proto__' && hasOwn.call(this.__data__, key); +}; + +/** + * Removes `key` and its value from the cache. + * + * ```js + * cache.del('foo'); + * ``` + * @title .del + * @param {String} `key` The key of the value to remove. + * @returns {Boolean} Returns `true` if the entry was removed successfully, else `false`. + * @api public + */ + +MapCache.prototype.del = function mapDelete(key) { + return this.has(key) && delete this.__data__[key]; +}; diff --git a/node_modules/map-cache/package.json b/node_modules/map-cache/package.json new file mode 100644 index 00000000..ed106caf --- /dev/null +++ b/node_modules/map-cache/package.json @@ -0,0 +1,91 @@ +{ + "_from": "map-cache@^0.2.2", + "_id": "map-cache@0.2.2", + "_inBundle": false, + "_integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "_location": "/map-cache", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "map-cache@^0.2.2", + "name": "map-cache", + "escapedName": "map-cache", + "rawSpec": "^0.2.2", + "saveSpec": null, + "fetchSpec": "^0.2.2" + }, + "_requiredBy": [ + "/fragment-cache", + "/snapdragon" + ], + "_resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "_shasum": "c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf", + "_spec": "map-cache@^0.2.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/snapdragon", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/map-cache/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Basic cache object for storing key-value pairs.", + "devDependencies": { + "gulp-format-md": "^0.1.9", + "should": "^8.3.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/map-cache", + "keywords": [ + "cache", + "get", + "has", + "object", + "set", + "storage", + "store" + ], + "license": "MIT", + "main": "index.js", + "name": "map-cache", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/map-cache.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "config-cache", + "option-cache", + "cache-base" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.2.2" +} diff --git a/node_modules/map-visit/LICENSE b/node_modules/map-visit/LICENSE new file mode 100644 index 00000000..83b56e70 --- /dev/null +++ b/node_modules/map-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/map-visit/README.md b/node_modules/map-visit/README.md new file mode 100644 index 00000000..5ab02d45 --- /dev/null +++ b/node_modules/map-visit/README.md @@ -0,0 +1,155 @@ +# map-visit [![NPM version](https://img.shields.io/npm/v/map-visit.svg?style=flat)](https://www.npmjs.com/package/map-visit) [![NPM monthly downloads](https://img.shields.io/npm/dm/map-visit.svg?style=flat)](https://npmjs.org/package/map-visit) [![NPM total downloads](https://img.shields.io/npm/dt/map-visit.svg?style=flat)](https://npmjs.org/package/map-visit) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/map-visit.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/map-visit) + +> Map `visit` over an array of objects. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save map-visit +``` + +## Usage + +```js +var mapVisit = require('map-visit'); +``` + +## What does this do? + +**Assign/Merge/Extend vs. Visit** + +Let's say you want to add a `set` method to your application that will: + +* set key-value pairs on a `data` object +* extend objects onto the `data` object +* extend arrays of objects onto the data object + +**Example using `extend`** + +Here is one way to accomplish this using Lo-Dash's `extend` (comparable to `Object.assign`): + +```js +var _ = require('lodash'); + +var obj = { + data: {}, + set: function (key, value) { + if (Array.isArray(key)) { + _.extend.apply(_, [obj.data].concat(key)); + } else if (typeof key === 'object') { + _.extend(obj.data, key); + } else { + obj.data[key] = value; + } + } +}; + +obj.set('a', 'a'); +obj.set([{b: 'b'}, {c: 'c'}]); +obj.set({d: {e: 'f'}}); + +console.log(obj.data); +//=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }} +``` + +The above approach works fine for most use cases. However, **if you also want to emit an event** each time a property is added to the `data` object, or you want more control over what happens as the object is extended, a better approach would be to use `visit`. + +**Example using `visit`** + +In this approach: + +* when an array is passed to `set`, the `mapVisit` library calls the `set` method on each object in the array. +* when an object is passed, `visit` calls `set` on each property in the object. + +As a result, the `data` event will be emitted every time a property is added to `data` (events are just an example, you can use this approach to perform any necessary logic every time the method is called). + +```js +var mapVisit = require('map-visit'); +var visit = require('object-visit'); + +var obj = { + data: {}, + set: function (key, value) { + if (Array.isArray(key)) { + mapVisit(obj, 'set', key); + } else if (typeof key === 'object') { + visit(obj, 'set', key); + } else { + // simulate an event-emitter + console.log('emit', key, value); + obj.data[key] = value; + } + } +}; + +obj.set('a', 'a'); +obj.set([{b: 'b'}, {c: 'c'}]); +obj.set({d: {e: 'f'}}); +obj.set({g: 'h', i: 'j', k: 'l'}); + +console.log(obj.data); +//=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }, g: 'h', i: 'j', k: 'l'} + +// events would look something like: +// emit a a +// emit b b +// emit c c +// emit d { e: 'f' } +// emit g h +// emit i j +// emit k l +``` + +## About + +### Related projects + +* [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.") +* [object-visit](https://www.npmjs.com/package/object-visit): Call a specified method on each value in the given object. | [homepage](https://github.com/jonschlinkert/object-visit "Call a specified method on each value in the given object.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 15 | [jonschlinkert](https://github.com/jonschlinkert) | +| 7 | [doowb](https://github.com/doowb) | + +### 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 09, 2017._ \ No newline at end of file diff --git a/node_modules/map-visit/index.js b/node_modules/map-visit/index.js new file mode 100644 index 00000000..bc54ccc4 --- /dev/null +++ b/node_modules/map-visit/index.js @@ -0,0 +1,37 @@ +'use strict'; + +var util = require('util'); +var visit = require('object-visit'); + +/** + * Map `visit` over an array of objects. + * + * @param {Object} `collection` The context in which to invoke `method` + * @param {String} `method` Name of the method to call on `collection` + * @param {Object} `arr` Array of objects. + */ + +module.exports = function mapVisit(collection, method, val) { + if (isObject(val)) { + return visit.apply(null, arguments); + } + + if (!Array.isArray(val)) { + throw new TypeError('expected an array: ' + util.inspect(val)); + } + + var args = [].slice.call(arguments, 3); + + for (var i = 0; i < val.length; i++) { + var ele = val[i]; + if (isObject(ele)) { + visit.apply(null, [collection, method, ele].concat(args)); + } else { + collection[method].apply(collection, [ele].concat(args)); + } + } +}; + +function isObject(val) { + return val && (typeof val === 'function' || (!Array.isArray(val) && typeof val === 'object')); +} diff --git a/node_modules/map-visit/package.json b/node_modules/map-visit/package.json new file mode 100644 index 00000000..433900a2 --- /dev/null +++ b/node_modules/map-visit/package.json @@ -0,0 +1,113 @@ +{ + "_from": "map-visit@^1.0.0", + "_id": "map-visit@1.0.0", + "_inBundle": false, + "_integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "_location": "/map-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "map-visit@^1.0.0", + "name": "map-visit", + "escapedName": "map-visit", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/collection-visit" + ], + "_resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "_shasum": "ecdca8f13144e660f1b5bd41f12f3479d98dfb8f", + "_spec": "map-visit@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/collection-visit", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/map-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "email": "brian.woodward@gmail.com", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "object-visit": "^1.0.0" + }, + "deprecated": false, + "description": "Map `visit` over an array of objects.", + "devDependencies": { + "clone-deep": "^0.2.4", + "extend-shallow": "^2.0.1", + "gulp-format-md": "^0.1.12", + "lodash": "^4.17.4", + "mocha": "^3.2.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/map-visit", + "keywords": [ + "array", + "arrays", + "function", + "helper", + "invoke", + "key", + "map", + "method", + "object", + "objects", + "value", + "visit", + "visitor" + ], + "license": "MIT", + "main": "index.js", + "name": "map-visit", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/map-visit.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "collection-visit", + "object-visit" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ] + }, + "version": "1.0.0" +} diff --git a/node_modules/markdown-escapes/index.js b/node_modules/markdown-escapes/index.js new file mode 100644 index 00000000..f8bea48e --- /dev/null +++ b/node_modules/markdown-escapes/index.js @@ -0,0 +1,57 @@ +'use strict' + +module.exports = escapes + +var defaults = [ + '\\', + '`', + '*', + '{', + '}', + '[', + ']', + '(', + ')', + '#', + '+', + '-', + '.', + '!', + '_', + '>' +] + +var gfm = defaults.concat(['~', '|']) + +var commonmark = gfm.concat([ + '\n', + '"', + '$', + '%', + '&', + "'", + ',', + '/', + ':', + ';', + '<', + '=', + '?', + '@', + '^' +]) + +escapes.default = defaults +escapes.gfm = gfm +escapes.commonmark = commonmark + +// Get markdown escapes. +function escapes(options) { + var settings = options || {} + + if (settings.commonmark) { + return commonmark + } + + return settings.gfm ? gfm : defaults +} diff --git a/node_modules/markdown-escapes/license b/node_modules/markdown-escapes/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/markdown-escapes/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/markdown-escapes/package.json b/node_modules/markdown-escapes/package.json new file mode 100644 index 00000000..6bcffc78 --- /dev/null +++ b/node_modules/markdown-escapes/package.json @@ -0,0 +1,112 @@ +{ + "_from": "markdown-escapes@^1.0.0", + "_id": "markdown-escapes@1.0.4", + "_inBundle": false, + "_integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==", + "_location": "/markdown-escapes", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "markdown-escapes@^1.0.0", + "name": "markdown-escapes", + "escapedName": "markdown-escapes", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse", + "/remark-stringify" + ], + "_resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.4.tgz", + "_shasum": "c95415ef451499d7602b91095f3c8e8975f78535", + "_spec": "markdown-escapes@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/markdown-escapes/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "List of escapable characters in markdown", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^14.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.25.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "homepage": "https://github.com/wooorm/markdown-escapes#readme", + "keywords": [ + "markdown", + "escape", + "pedantic", + "gfm", + "commonmark" + ], + "license": "MIT", + "name": "markdown-escapes", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/markdown-escapes.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s markdownEscapes -o markdown-escapes.js", + "build-mangle": "browserify . -s markdownEscapes -p tinyify -o markdown-escapes.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.4", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "markdown-escapes.js" + ] + } +} diff --git a/node_modules/markdown-escapes/readme.md b/node_modules/markdown-escapes/readme.md new file mode 100644 index 00000000..a7404526 --- /dev/null +++ b/node_modules/markdown-escapes/readme.md @@ -0,0 +1,80 @@ +# markdown-escapes + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +List of escapable characters in markdown. + +## Install + +[npm][]: + +```sh +npm install markdown-escapes +``` + +## Use + +```js +var escapes = require('markdown-escapes'); + +// Access by property: +escapes.commonmark; //=> ['\\', '`', ..., '@', '^'] + +// Access by options object: +escapes({gfm: true}); //=> ['\\', '`', ..., '~', '|'] +``` + +## API + +### `escapes([options])` + +Get escapes. +Supports `options.commonmark` and `options.gfm`, which when `true` returns the +extra escape characters supported by those flavors. + +###### Returns + +`Array.`. + +### `escapes.default` + +List of default escapable characters. + +### `escapes.gfm` + +List of escapable characters in GFM (which includes all `default`s). + +### `escapes.commonmark` + +List of escapable characters in CommonMark (which includes all `gfm`s). + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/markdown-escapes.svg + +[build]: https://travis-ci.org/wooorm/markdown-escapes + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/markdown-escapes.svg + +[coverage]: https://codecov.io/github/wooorm/markdown-escapes + +[downloads-badge]: https://img.shields.io/npm/dm/markdown-escapes.svg + +[downloads]: https://www.npmjs.com/package/markdown-escapes + +[size-badge]: https://img.shields.io/bundlephobia/minzip/markdown-escapes.svg + +[size]: https://bundlephobia.com/result?p=markdown-escapes + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com diff --git a/node_modules/markdown-extensions/index.js b/node_modules/markdown-extensions/index.js new file mode 100644 index 00000000..fcb0e050 --- /dev/null +++ b/node_modules/markdown-extensions/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = require('./markdown-extensions.json'); diff --git a/node_modules/markdown-extensions/license b/node_modules/markdown-extensions/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/markdown-extensions/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/markdown-extensions/markdown-extensions.json b/node_modules/markdown-extensions/markdown-extensions.json new file mode 100644 index 00000000..bc79151d --- /dev/null +++ b/node_modules/markdown-extensions/markdown-extensions.json @@ -0,0 +1,10 @@ +[ + "md", + "markdown", + "mdown", + "mkdn", + "mkd", + "mdwn", + "mkdown", + "ron" +] diff --git a/node_modules/markdown-extensions/package.json b/node_modules/markdown-extensions/package.json new file mode 100644 index 00000000..06a1af8d --- /dev/null +++ b/node_modules/markdown-extensions/package.json @@ -0,0 +1,68 @@ +{ + "_from": "markdown-extensions@^1.1.0", + "_id": "markdown-extensions@1.1.1", + "_inBundle": false, + "_integrity": "sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q==", + "_location": "/markdown-extensions", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "markdown-extensions@^1.1.0", + "name": "markdown-extensions", + "escapedName": "markdown-extensions", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/remark-cli" + ], + "_resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-1.1.1.tgz", + "_shasum": "fea03b539faeaee9b4ef02a3769b455b189f7fc3", + "_spec": "markdown-extensions@^1.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-cli", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/markdown-extensions/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "List of Markdown file extensions", + "devDependencies": { + "ava": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "markdown-extensions.json" + ], + "homepage": "https://github.com/sindresorhus/markdown-extensions#readme", + "keywords": [ + "markdown", + "md", + "ext", + "extensions", + "extension", + "file", + "json", + "list", + "array" + ], + "license": "MIT", + "name": "markdown-extensions", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/markdown-extensions.git" + }, + "scripts": { + "test": "ava" + }, + "version": "1.1.1" +} diff --git a/node_modules/markdown-extensions/readme.md b/node_modules/markdown-extensions/readme.md new file mode 100644 index 00000000..34e441ab --- /dev/null +++ b/node_modules/markdown-extensions/readme.md @@ -0,0 +1,27 @@ +# markdown-extensions [![Build Status](https://travis-ci.org/sindresorhus/markdown-extensions.svg?branch=master)](https://travis-ci.org/sindresorhus/markdown-extensions) + +> List of Markdown file extensions + +The list is just a [JSON file](markdown-extensions.json) and can be used wherever. + + +## Install + +``` +$ npm install --save markdown-extensions +``` + + +## Usage + +```js +var markdownExtensions = require('markdown-extensions'); + +console.log(markdownExtensions); +//=> ['md', ...] +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/markdown-table/index.js b/node_modules/markdown-table/index.js new file mode 100644 index 00000000..9a94af56 --- /dev/null +++ b/node_modules/markdown-table/index.js @@ -0,0 +1,250 @@ +'use strict' + +module.exports = markdownTable + +var dotRe = /\./ +var lastDotRe = /\.[^.]*$/ + +// Characters. +var space = ' ' +var lineFeed = '\n' +var dash = '-' +var dot = '.' +var colon = ':' +var lowercaseC = 'c' +var lowercaseL = 'l' +var lowercaseR = 'r' +var verticalBar = '|' + +var minCellSize = 3 + +// Create a table from a matrix of strings. +function markdownTable(table, options) { + var settings = options || {} + var delimiter = settings.delimiter + var start = settings.start + var end = settings.end + var alignment = settings.align + var calculateStringLength = settings.stringLength || lengthNoop + var cellCount = 0 + var rowIndex = -1 + var rowLength = table.length + var sizes = [] + var align + var rule + var rows + var row + var cells + var index + var position + var size + var value + var spacing + var before + var after + + alignment = alignment ? alignment.concat() : [] + + if (delimiter === null || delimiter === undefined) { + delimiter = space + verticalBar + space + } + + if (start === null || start === undefined) { + start = verticalBar + space + } + + if (end === null || end === undefined) { + end = space + verticalBar + } + + while (++rowIndex < rowLength) { + row = table[rowIndex] + + index = -1 + + if (row.length > cellCount) { + cellCount = row.length + } + + while (++index < cellCount) { + position = row[index] ? dotindex(row[index]) : null + + if (!sizes[index]) { + sizes[index] = minCellSize + } + + if (position > sizes[index]) { + sizes[index] = position + } + } + } + + if (typeof alignment === 'string') { + alignment = pad(cellCount, alignment).split('') + } + + // Make sure only valid alignments are used. + index = -1 + + while (++index < cellCount) { + align = alignment[index] + + if (typeof align === 'string') { + align = align.charAt(0).toLowerCase() + } + + if ( + align !== lowercaseL && + align !== lowercaseR && + align !== lowercaseC && + align !== dot + ) { + align = '' + } + + alignment[index] = align + } + + rowIndex = -1 + rows = [] + + while (++rowIndex < rowLength) { + row = table[rowIndex] + + index = -1 + cells = [] + + while (++index < cellCount) { + value = row[index] + + value = stringify(value) + + if (alignment[index] === dot) { + position = dotindex(value) + + size = + sizes[index] + + (dotRe.test(value) ? 0 : 1) - + (calculateStringLength(value) - position) + + cells[index] = value + pad(size - 1) + } else { + cells[index] = value + } + } + + rows[rowIndex] = cells + } + + sizes = [] + rowIndex = -1 + + while (++rowIndex < rowLength) { + cells = rows[rowIndex] + + index = -1 + + while (++index < cellCount) { + value = cells[index] + + if (!sizes[index]) { + sizes[index] = minCellSize + } + + size = calculateStringLength(value) + + if (size > sizes[index]) { + sizes[index] = size + } + } + } + + rowIndex = -1 + + while (++rowIndex < rowLength) { + cells = rows[rowIndex] + + index = -1 + + if (settings.pad !== false) { + while (++index < cellCount) { + value = cells[index] + + position = sizes[index] - (calculateStringLength(value) || 0) + spacing = pad(position) + + if (alignment[index] === lowercaseR || alignment[index] === dot) { + value = spacing + value + } else if (alignment[index] === lowercaseC) { + position /= 2 + + if (position % 1 === 0) { + before = position + after = position + } else { + before = position + 0.5 + after = position - 0.5 + } + + value = pad(before) + value + pad(after) + } else { + value += spacing + } + + cells[index] = value + } + } + + rows[rowIndex] = cells.join(delimiter) + } + + if (settings.rule !== false) { + index = -1 + rule = [] + + while (++index < cellCount) { + // When `pad` is false, make the rule the same size as the first row. + if (settings.pad === false) { + value = table[0][index] + spacing = calculateStringLength(stringify(value)) + spacing = spacing > minCellSize ? spacing : minCellSize + } else { + spacing = sizes[index] + } + + align = alignment[index] + + // When `align` is left, don't add colons. + value = align === lowercaseR || align === '' ? dash : colon + value += pad(spacing - 2, dash) + value += align !== lowercaseL && align !== '' ? colon : dash + + rule[index] = value + } + + rows.splice(1, 0, rule.join(delimiter)) + } + + return start + rows.join(end + lineFeed + start) + end +} + +function stringify(value) { + return value === null || value === undefined ? '' : String(value) +} + +// Get the length of `value`. +function lengthNoop(value) { + return String(value).length +} + +// Get a string consisting of `length` `character`s. +function pad(length, character) { + return new Array(length + 1).join(character || space) +} + +// Get the position of the last dot in `value`. +function dotindex(value) { + var match = lastDotRe.exec(value) + + return match ? match.index + 1 : value.length +} diff --git a/node_modules/markdown-table/license b/node_modules/markdown-table/license new file mode 100644 index 00000000..0c06d5bc --- /dev/null +++ b/node_modules/markdown-table/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 Titus Wormer + +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/markdown-table/package.json b/node_modules/markdown-table/package.json new file mode 100644 index 00000000..66df5902 --- /dev/null +++ b/node_modules/markdown-table/package.json @@ -0,0 +1,115 @@ +{ + "_from": "markdown-table@^1.1.0", + "_id": "markdown-table@1.1.3", + "_inBundle": false, + "_integrity": "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q==", + "_location": "/markdown-table", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "markdown-table@^1.1.0", + "name": "markdown-table", + "escapedName": "markdown-table", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/remark-stringify" + ], + "_resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.3.tgz", + "_shasum": "9fcb69bcfdb8717bfd0398c6ec2d93036ef8de60", + "_spec": "markdown-table@^1.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-stringify", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/markdown-table/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Markdown/ASCII tables", + "devDependencies": { + "browserify": "^16.0.0", + "chalk": "^2.0.0", + "nyc": "^14.0.0", + "prettier": "^1.12.1", + "remark-cli": "^6.0.0", + "remark-preset-wooorm": "^4.0.0", + "strip-ansi": "^5.0.0", + "tape": "^4.4.0", + "tinyify": "^2.5.0", + "xo": "^0.24.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/wooorm/markdown-table#readme", + "keywords": [ + "text", + "markdown", + "table", + "align", + "ascii", + "rows", + "tabular" + ], + "license": "MIT", + "name": "markdown-table", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/markdown-table.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s markdownTable -o markdown-table.js", + "build-mangle": "browserify . -s markdownTable -p tinyify -o markdown-table.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "complexity": "off", + "max-depth": "off" + }, + "ignores": [ + "markdown-table.js" + ] + } +} diff --git a/node_modules/markdown-table/readme.md b/node_modules/markdown-table/readme.md new file mode 100644 index 00000000..d9afa1df --- /dev/null +++ b/node_modules/markdown-table/readme.md @@ -0,0 +1,180 @@ +# markdown-table + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Generate fancy [Markdown][fancy]/ASCII tables. + +## Installation + +[npm][]: + +```bash +npm install markdown-table +``` + +## Usage + +Normal usage (defaults to left-alignment): + +```javascript +var table = require('markdown-table') + +table([ + ['Branch', 'Commit'], + ['master', '0123456789abcdef'], + ['staging', 'fedcba9876543210'] +]) +``` + +Yields: + +```markdown +| Branch | Commit | +| ------- | ---------------- | +| master | 0123456789abcdef | +| staging | fedcba9876543210 | +``` + +With alignment: + +```javascript +table( + [ + ['Beep', 'No.', 'Boop'], + ['beep', '1024', 'xyz'], + ['boop', '3388450', 'tuv'], + ['foo', '10106', 'qrstuv'], + ['bar', '45', 'lmno'] + ], + { + align: ['l', 'c', 'r'] + } +) +``` + +Yields: + +```markdown +| Beep | No. | Boop | +| :--- | :-----: | -----: | +| beep | 1024 | xyz | +| boop | 3388450 | tuv | +| foo | 10106 | qrstuv | +| bar | 45 | lmno | +``` + +Alignment on dots: + +```javascript +table([['No.'], ['0.1.2'], ['11.22.33'], ['5.6.'], ['1.22222']], { + align: '.' +}) +``` + +Yields: + +```markdown +| No. | +| :---------: | +| 0.1.2 | +| 11.22.33 | +| 5.6. | +| 1.22222 | +``` + +## API + +### `markdownTable(table[, options])` + +Turns a given matrix of strings (an array of arrays of strings) into a table. + +##### `options` + +###### `options.align` + +One style for all columns, or styles for their respective columns (`string` or +`Array.`). Each style is either `'l'` (left), `'r'` (right), `'c'` +(centre), or `'.'` (dot). Other values are treated as `''`, which doesn’t place +the colon but does left align. _Only the lowercased first character is used, +so `Right` is fine._ + +###### `options.delimiter` + +Value to insert between cells (`string`, default: `' | '`). Careful, setting +this to a non-pipe breaks GitHub Flavoured Markdown. + +###### `options.start` + +Value to insert at the beginning of every row (`string`, default: `'| '`). + +###### `options.end` + +Value to insert at the end of every row (`string`, default: `' |'`). + +###### `options.rule` + +Whether to display a rule between the header and the body of the table +(`boolean`, default: `true`). Careful, will break GitHub Flavoured Markdown +when `false`. + +###### `options.stringLength` + +Method to detect the length of a cell (`Function`, default: `s => s.length`). + +ANSI-sequences mess up tables on terminals. To fix this, you have to +pass in a `stringLength` option to detect the “visible” length of a +cell. + +```javascript +var strip = require('strip-ansi') + +function stringLength(cell) { + return strip(cell).length +} +``` + +###### `options.pad` + +Whether to pad the markdown for table cells to make them the same width +(`boolean`, default: `true`). Setting this to false will cause the table +rows to remain staggered. + +## Inspiration + +The original idea and basic implementation was inspired by James +Halliday’s [text-table][] library. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/markdown-table.svg + +[build]: https://travis-ci.org/wooorm/markdown-table + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/markdown-table.svg + +[coverage]: https://codecov.io/github/wooorm/markdown-table + +[downloads-badge]: https://img.shields.io/npm/dm/markdown-table.svg + +[downloads]: https://www.npmjs.com/package/markdown-table + +[size-badge]: https://img.shields.io/bundlephobia/minzip/markdown-table.svg + +[size]: https://bundlephobia.com/result?p=markdown-table + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[fancy]: https://help.github.com/articles/github-flavored-markdown/#tables + +[text-table]: https://github.com/substack/text-table diff --git a/node_modules/math-random/.travis.yml b/node_modules/math-random/.travis.yml new file mode 100644 index 00000000..054c803e --- /dev/null +++ b/node_modules/math-random/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "6" + - "4" + - "0.12" + - "0.10" diff --git a/node_modules/math-random/browser.js b/node_modules/math-random/browser.js new file mode 100644 index 00000000..479a5f6e --- /dev/null +++ b/node_modules/math-random/browser.js @@ -0,0 +1,17 @@ +module.exports = (function (global) { + var uint32 = 'Uint32Array' in global + var crypto = global.crypto || global.msCrypto + var rando = crypto && typeof crypto.getRandomValues === 'function' + var good = uint32 && rando + if (!good) return Math.random + + var arr = new Uint32Array(1) + var max = Math.pow(2, 32) + function random () { + crypto.getRandomValues(arr) + return arr[0] / max + } + + random.cryptographic = true + return random +})(typeof self !== 'undefined' ? self : window) diff --git a/node_modules/math-random/node.js b/node_modules/math-random/node.js new file mode 100644 index 00000000..0edf239c --- /dev/null +++ b/node_modules/math-random/node.js @@ -0,0 +1,13 @@ +var crypto = require('crypto') +var max = Math.pow(2, 32) + +module.exports = random +module.exports.cryptographic = true + +function random () { + var buf = crypto + .randomBytes(4) + .readUInt32BE(0) + + return buf / max +} diff --git a/node_modules/math-random/package.json b/node_modules/math-random/package.json new file mode 100644 index 00000000..b4e40741 --- /dev/null +++ b/node_modules/math-random/package.json @@ -0,0 +1,51 @@ +{ + "_from": "math-random@^1.0.1", + "_id": "math-random@1.0.4", + "_inBundle": false, + "_integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", + "_location": "/math-random", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "math-random@^1.0.1", + "name": "math-random", + "escapedName": "math-random", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/randomatic" + ], + "_resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", + "_shasum": "5dd6943c938548267016d4e34f057583080c514c", + "_spec": "math-random@^1.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/randomatic", + "author": { + "name": "Michael Rhodes" + }, + "browser": "browser.js", + "bugs": { + "url": "https://github.com/michaelrhodes/math-random/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "math-random is an drop-in replacement for Math.random that uses cryptographically secure random number generation, where available. It works in both browser and node environments.", + "devDependencies": { + "array-unique": "~0.2.1", + "dexy": "github:michaelrhodes/dexy#1.0.1" + }, + "homepage": "https://github.com/michaelrhodes/math-random#readme", + "license": "MIT", + "main": "node.js", + "name": "math-random", + "repository": { + "type": "git", + "url": "git+https://github.com/michaelrhodes/math-random.git" + }, + "scripts": { + "test": "dexy test.js" + }, + "version": "1.0.4" +} diff --git a/node_modules/math-random/readme.md b/node_modules/math-random/readme.md new file mode 100644 index 00000000..17beb706 --- /dev/null +++ b/node_modules/math-random/readme.md @@ -0,0 +1,26 @@ +# math-random + +math-random is an drop-in replacement for Math.random that uses cryptographically secure random number generation, where available. It works in both browser and node environments. + +[![Build status](https://travis-ci.org/michaelrhodes/math-random.svg?branch=master)](https://travis-ci.org/michaelrhodes/math-random) + +## Install + +```sh +npm install math-random +``` + +### Usage + +```js +var random = require('math-random') + +console.log(random()) +=> 0.584293719381094 + +console.log(random.cryptographic) +=> true || undefined +``` + +### License +[MIT](http://opensource.org/licenses/MIT) diff --git a/node_modules/math-random/test.js b/node_modules/math-random/test.js new file mode 100644 index 00000000..aaea5149 --- /dev/null +++ b/node_modules/math-random/test.js @@ -0,0 +1,21 @@ +var assert = console.assert +var unique = require('array-unique') +var random = require('./') + +var iterations = 10000 +var number, cache = [] + +for (var i = 0; i < iterations; i++) { + number = random() + if (number < 0) { + assert(false, 'Random numbers should be greater than or equal to zero') + break + } + if (number >= 1) { + assert(false, 'Random numbers should be less than one') + break + } + cache.push(number) +} + +assert(unique(cache).length === iterations, 'Random numbers should be unique') diff --git a/node_modules/mdast-comment-marker/index.js b/node_modules/mdast-comment-marker/index.js new file mode 100644 index 00000000..b1914df6 --- /dev/null +++ b/node_modules/mdast-comment-marker/index.js @@ -0,0 +1,78 @@ +'use strict' + +module.exports = marker + +var whiteSpaceExpression = /\s+/g + +var parametersExpression = /\s+([-a-z0-9_]+)(?:=(?:"((?:\\[\s\S]|[^"])+)"|'((?:\\[\s\S]|[^'])+)'|((?:\\[\s\S]|[^"'\s])+)))?/gi + +var commentExpression = /\s*([a-zA-Z0-9-]+)(\s+([\s\S]*))?\s*/ + +var markerExpression = new RegExp( + '(\\s*\\s*)' +) + +// Parse a comment marker. +function marker(node) { + var type + var value + var match + var params + + if (!node) { + return null + } + + type = node.type + + if (type !== 'html' && type !== 'comment') { + return null + } + + value = node.value + match = value.match(type === 'comment' ? commentExpression : markerExpression) + + if (!match || match[0].length !== value.length) { + return null + } + + match = match.slice(node.type === 'comment' ? 1 : 2) + + params = parameters(match[1] || '') + + if (!params) { + return null + } + + return { + name: match[0], + attributes: match[2] || '', + parameters: params, + node: node + } +} + +// Parse `value` into an object. +function parameters(value) { + var attributes = {} + var rest = value.replace(parametersExpression, replacer) + + return rest.replace(whiteSpaceExpression, '') ? null : attributes + + // eslint-disable-next-line max-params + function replacer($0, $1, $2, $3, $4) { + var result = $2 || $3 || $4 || '' + + if (result === 'true' || result === '') { + result = true + } else if (result === 'false') { + result = false + } else if (!isNaN(result)) { + result = Number(result) + } + + attributes[$1] = result + + return '' + } +} diff --git a/node_modules/mdast-comment-marker/license b/node_modules/mdast-comment-marker/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/mdast-comment-marker/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/mdast-comment-marker/package.json b/node_modules/mdast-comment-marker/package.json new file mode 100644 index 00000000..c4c695ca --- /dev/null +++ b/node_modules/mdast-comment-marker/package.json @@ -0,0 +1,119 @@ +{ + "_from": "mdast-comment-marker@^1.0.0", + "_id": "mdast-comment-marker@1.1.2", + "_inBundle": false, + "_integrity": "sha512-vTFXtmbbF3rgnTh3Zl3irso4LtvwUq/jaDvT2D1JqTGAwaipcS7RpTxzi6KjoRqI9n2yuAhzLDAC8xVTF3XYVQ==", + "_location": "/mdast-comment-marker", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "mdast-comment-marker@^1.0.0", + "name": "mdast-comment-marker", + "escapedName": "mdast-comment-marker", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-message-control", + "/remark-preset-lint-consistent/remark-message-control" + ], + "_resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-1.1.2.tgz", + "_shasum": "5ad2e42cfcc41b92a10c1421a98c288d7b447a6d", + "_spec": "mdast-comment-marker@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-message-control", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/mdast-comment-marker/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Masayuki Izumi", + "email": "masayuki@izumin.info", + "url": "http://izumin.info" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "mdast utility to parse a comment marker", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/mdast-comment-marker#readme", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "marker", + "comment" + ], + "license": "MIT", + "name": "mdast-comment-marker", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/mdast-comment-marker.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s mdastCommentMarker > mdast-comment-marker.js", + "build-mangle": "browserify . -s mdastCommentMarker -p tinyify > mdast-comment-marker.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.2", + "xo": { + "prettier": true, + "esnext": false, + "ignore": [ + "mdast-comment-marker.js" + ] + } +} diff --git a/node_modules/mdast-comment-marker/readme.md b/node_modules/mdast-comment-marker/readme.md new file mode 100644 index 00000000..eff1b386 --- /dev/null +++ b/node_modules/mdast-comment-marker/readme.md @@ -0,0 +1,162 @@ +# mdast-comment-marker + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**mdast**][mdast] utility to parse comment markers. + +## Install + +[npm][]: + +```sh +npm install mdast-comment-marker +``` + +## Use + +```js +var marker = require('mdast-comment-marker'); + +console.log(marker({ + type: 'html', + value: '' +})); + +console.log(marker({ + type: 'html', + value: '' +})); + +console.log(marker({ + type: 'html', + value: '' +})); + +// Also supports MDX comment nodes. +console.log(marker({ + type: 'comment', + value: 'bar' +})); +``` + +Yields: + +```js +{ name: 'foo', + attributes: '', + parameters: {}, + node: { type: 'html', value: '' } } +{ name: 'foo', + attributes: 'bar baz=12.4 qux="test test" quux=\'false\'', + parameters: { bar: true, baz: 12.4, qux: 'test test', quux: false }, + node: + { type: 'html', + value: '' } } +null +{ name: 'bar', + attributes: '', + parameters: {}, + node: { type: 'comment', value: 'bar' } } +``` + +## API + +### `marker(node)` + +Parse a comment marker. + +###### Parameters + +* `node` ([`Node`][node]) — [Node][] to parse + +###### Returns + +[`Marker?`][marker] — Information, when applicable. + +### `Marker` + +A comment marker. + +###### Properties + +* `name` (`string`) — Name of marker +* `attributes` (`string`) — Value after name +* `parameters` (`Object`) — Parsed attributes, tries to convert + values to numbers and booleans when possible +* `node` ([`Node`][node]) — Reference to given node + +## Security + +Use of `mdast-comment-marker` does not involve [**hast**][hast], user content, +or change the tree, so there are no openings for +[cross-site scripting (XSS)][xss] attacks. + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/mdast-comment-marker.svg + +[build]: https://travis-ci.org/syntax-tree/mdast-comment-marker + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-comment-marker.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-comment-marker + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-comment-marker.svg + +[downloads]: https://www.npmjs.com/package/mdast-comment-marker + +[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-comment-marker.svg + +[size]: https://bundlephobia.com/result?p=mdast-comment-marker + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/unist#node + +[marker]: #marker + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[hast]: https://github.com/syntax-tree/hast diff --git a/node_modules/mdast-util-compact/index.js b/node_modules/mdast-util-compact/index.js new file mode 100644 index 00000000..eee0fdfb --- /dev/null +++ b/node_modules/mdast-util-compact/index.js @@ -0,0 +1,61 @@ +'use strict' + +var visit = require('unist-util-visit') + +module.exports = compact + +// Make an mdast tree compact by merging adjacent text nodes. +function compact(tree, commonmark) { + visit(tree, visitor) + + return tree + + function visitor(child, index, parent) { + var siblings = parent ? parent.children : [] + var prev = index && siblings[index - 1] + + if ( + prev && + child.type === prev.type && + mergeable(prev, commonmark) && + mergeable(child, commonmark) + ) { + if (child.value) { + prev.value += child.value + } + + if (child.children) { + prev.children = prev.children.concat(child.children) + } + + siblings.splice(index, 1) + + if (prev.position && child.position) { + prev.position.end = child.position.end + } + + return index + } + } +} + +function mergeable(node, commonmark) { + var start + var end + + if (node.type === 'text') { + if (!node.position) { + return true + } + + start = node.position.start + end = node.position.end + + // Only merge nodes which occupy the same size as their `value`. + return ( + start.line !== end.line || end.column - start.column === node.value.length + ) + } + + return commonmark && node.type === 'blockquote' +} diff --git a/node_modules/mdast-util-compact/license b/node_modules/mdast-util-compact/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/mdast-util-compact/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/mdast-util-compact/package.json b/node_modules/mdast-util-compact/package.json new file mode 100644 index 00000000..ef6ed5bb --- /dev/null +++ b/node_modules/mdast-util-compact/package.json @@ -0,0 +1,113 @@ +{ + "_from": "mdast-util-compact@^1.0.0", + "_id": "mdast-util-compact@1.0.4", + "_inBundle": false, + "_integrity": "sha512-3YDMQHI5vRiS2uygEFYaqckibpJtKq5Sj2c8JioeOQBU6INpKbdWzfyLqFFnDwEcEnRFIdMsguzs5pC1Jp4Isg==", + "_location": "/mdast-util-compact", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "mdast-util-compact@^1.0.0", + "name": "mdast-util-compact", + "escapedName": "mdast-util-compact", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-stringify" + ], + "_resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-1.0.4.tgz", + "_shasum": "d531bb7667b5123abf20859be086c4d06c894593", + "_spec": "mdast-util-compact@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-stringify", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/mdast-util-compact/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unist-util-visit": "^1.1.0" + }, + "deprecated": false, + "description": "Make an mdast tree compact", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^14.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unist-builder": "^2.0.0", + "xo": "^0.25.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/mdast-util-compact#readme", + "keywords": [ + "mdast", + "utility", + "compact", + "node" + ], + "license": "MIT", + "name": "mdast-util-compact", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/mdast-util-compact.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s mdastUtilCompact > mdast-util-compact.js", + "build-mangle": "browserify . -s mdastUtilCompact -p tinyify > mdast-util-compact.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.4", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "mdast-util-compact.js" + ] + } +} diff --git a/node_modules/mdast-util-compact/readme.md b/node_modules/mdast-util-compact/readme.md new file mode 100644 index 00000000..304b6600 --- /dev/null +++ b/node_modules/mdast-util-compact/readme.md @@ -0,0 +1,127 @@ +# mdast-util-compact + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**mdast**][mdast] utility to make trees compact: collapse text nodes (when +possible) and blockquotes (in commonmark mode). + +## Install + +[npm][]: + +```sh +npm install mdast-util-compact +``` + +## Usage + +```js +var u = require('unist-builder') +var compact = require('mdast-util-compact') + +var tree = u('strong', [u('text', 'alpha'), u('text', ' '), u('text', 'bravo')]) + +compact(tree) + +console.log(tree) +``` + +Yields: + +```js +{ type: 'strong', + children: [ { type: 'text', value: 'alpha bravo' } ] } +``` + +## API + +### `compact(tree[, commonmark])` + +Walk the [tree][] and collapse nodes. +Combines adjacent [text][]s (but not when they represent entities or escapes). +If `commonmark` is `true`, collapses [blockquote][]s. + +Handles [positional information][position-information] properly. + +###### Returns + +The given `tree`. + +## Security + +Use of `mdast-util-compact` does not involve [**hast**][hast] or user content +so there are no openings for [cross-site scripting (XSS)][xss] attacks. + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [Code of Conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/mdast-util-compact.svg + +[build]: https://travis-ci.org/syntax-tree/mdast-util-compact + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-compact.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-compact + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-compact.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-compact + +[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-compact.svg + +[size]: https://bundlephobia.com/result?p=mdast-util-compact + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[tree]: https://github.com/syntax-tree/unist#tree + +[position-information]: https://github.com/syntax-tree/unist#positional-information + +[text]: https://github.com/syntax-tree/mdast#text + +[blockquote]: https://github.com/syntax-tree/mdast#blockquote + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[hast]: https://github.com/syntax-tree/hast diff --git a/node_modules/mdast-util-heading-style/index.js b/node_modules/mdast-util-heading-style/index.js new file mode 100644 index 00000000..ab69a710 --- /dev/null +++ b/node_modules/mdast-util-heading-style/index.js @@ -0,0 +1,44 @@ +'use strict' + +module.exports = style + +function style(node, relative) { + var last = node.children[node.children.length - 1] + var depth = node.depth + var pos = node && node.position && node.position.end + var final = last && last.position && last.position.end + + if (!pos) { + return null + } + + // This can only occur for `'atx'` and `'atx-closed'` headings. + // This might incorrectly match `'atx'` headings with lots of trailing white + // space as an `'atx-closed'` heading. + if (!last) { + if (pos.column - 1 <= depth * 2) { + return consolidate(depth, relative) + } + + return 'atx-closed' + } + + if (final.line + 1 === pos.line) { + return 'setext' + } + + if (final.column + depth < pos.column) { + return 'atx-closed' + } + + return consolidate(depth, relative) +} + +// Get the probable style of an atx-heading, depending on preferred style. +function consolidate(depth, relative) { + return depth < 3 + ? 'atx' + : relative === 'atx' || relative === 'setext' + ? relative + : null +} diff --git a/node_modules/mdast-util-heading-style/license b/node_modules/mdast-util-heading-style/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/mdast-util-heading-style/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/mdast-util-heading-style/package.json b/node_modules/mdast-util-heading-style/package.json new file mode 100644 index 00000000..6e516bc3 --- /dev/null +++ b/node_modules/mdast-util-heading-style/package.json @@ -0,0 +1,118 @@ +{ + "_from": "mdast-util-heading-style@^1.0.2", + "_id": "mdast-util-heading-style@1.0.6", + "_inBundle": false, + "_integrity": "sha512-8ZuuegRqS0KESgjAGW8zTx4tJ3VNIiIaGFNEzFpRSAQBavVc7AvOo9I4g3crcZBfYisHs4seYh0rAVimO6HyOw==", + "_location": "/mdast-util-heading-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "mdast-util-heading-style@^1.0.2", + "name": "mdast-util-heading-style", + "escapedName": "mdast-util-heading-style", + "rawSpec": "^1.0.2", + "saveSpec": null, + "fetchSpec": "^1.0.2" + }, + "_requiredBy": [ + "/remark-lint-heading-style", + "/remark-lint-no-heading-content-indent", + "/remark-preset-lint-markdown-style-guide/remark-lint-heading-style" + ], + "_resolved": "https://registry.npmjs.org/mdast-util-heading-style/-/mdast-util-heading-style-1.0.6.tgz", + "_shasum": "6410418926fd5673d40f519406b35d17da10e3c5", + "_spec": "mdast-util-heading-style@^1.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-heading-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/mdast-util-heading-style/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "mdast utility to get the style of a heading", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark": "^11.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/mdast-util-heading-style#readme", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "node", + "heading", + "style" + ], + "license": "MIT", + "name": "mdast-util-heading-style", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/mdast-util-heading-style.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s mdastUtilHeadingStyle > mdast-util-heading-style.js", + "build-mangle": "browserify . -s mdastUtilHeadingStyle -p tinyify > mdast-util-heading-style.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.6", + "xo": { + "prettier": true, + "esnext": false, + "ignore": [ + "mdast-util-heading-style.js" + ] + } +} diff --git a/node_modules/mdast-util-heading-style/readme.md b/node_modules/mdast-util-heading-style/readme.md new file mode 100644 index 00000000..8720fe43 --- /dev/null +++ b/node_modules/mdast-util-heading-style/readme.md @@ -0,0 +1,120 @@ +# mdast-util-heading-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**mdast**][mdast] utility to get the style of a heading. + +## Install + +[npm][]: + +```sh +npm install mdast-util-heading-style +``` + +## Use + +```js +var style = require('mdast-util-heading-style') +var unified = require('unified') +var parse = require('remark-parse') + +var processor = unified().use(parse) + +style(processor.parse('# ATX').children[0]) // => 'atx' +style(processor.parse('# ATX #\n').children[0]) // => 'atx-closed' +style(processor.parse('ATX\n===').children[0]) // => 'setext' + +style(processor.parse('### ATX').children[0]) // => null +style(processor.parse('### ATX').children[0], 'setext') // => 'setext' +``` + +## API + +### `style(node[, relative])` + +Get the heading style of a node. + +###### Parameters + +* `node` ([`Node`][node]) — Node to parse +* `relative` (`string`, optional) — Style to use for ambiguous headings + (atx-headings with a level of three or more could also be setext) + +###### Returns + +`string` (`'atx'`, `'atx-closed'`, or `'setext'`) — When an ambiguous +heading is found, either `relative` or `null` is returned. + +## Security + +Use of `mdast-util-heading-style` does not involve [**hast**][hast] so there are +no openings for [cross-site scripting (XSS)][xss] attacks. + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/mdast-util-heading-style.svg + +[build]: https://travis-ci.org/syntax-tree/mdast-util-heading-style + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-heading-style.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-heading-style + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-heading-style.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-heading-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-heading-style.svg + +[size]: https://bundlephobia.com/result?p=mdast-util-heading-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[license]: license + +[author]: https://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/unist#node + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[hast]: https://github.com/syntax-tree/hast diff --git a/node_modules/mdast-util-to-string/index.js b/node_modules/mdast-util-to-string/index.js new file mode 100644 index 00000000..2b9df1cb --- /dev/null +++ b/node_modules/mdast-util-to-string/index.js @@ -0,0 +1,30 @@ +'use strict' + +module.exports = toString + +// Get the text content of a node. +// Prefer the node’s plain-text fields, otherwise serialize its children, +// and if the given value is an array, serialize the nodes in it. +function toString(node) { + return ( + (node && + (node.value || + node.alt || + node.title || + ('children' in node && all(node.children)) || + ('length' in node && all(node)))) || + '' + ) +} + +function all(values) { + var result = [] + var length = values.length + var index = -1 + + while (++index < length) { + result[index] = toString(values[index]) + } + + return result.join('') +} diff --git a/node_modules/mdast-util-to-string/license b/node_modules/mdast-util-to-string/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/mdast-util-to-string/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/mdast-util-to-string/package.json b/node_modules/mdast-util-to-string/package.json new file mode 100644 index 00000000..47c7b9af --- /dev/null +++ b/node_modules/mdast-util-to-string/package.json @@ -0,0 +1,122 @@ +{ + "_from": "mdast-util-to-string@^1.0.2", + "_id": "mdast-util-to-string@1.1.0", + "_inBundle": false, + "_integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", + "_location": "/mdast-util-to-string", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "mdast-util-to-string@^1.0.2", + "name": "mdast-util-to-string", + "escapedName": "mdast-util-to-string", + "rawSpec": "^1.0.2", + "saveSpec": null, + "fetchSpec": "^1.0.2" + }, + "_requiredBy": [ + "/remark-lint-blockquote-indentation", + "/remark-lint-maximum-heading-length", + "/remark-lint-no-auto-link-without-protocol", + "/remark-lint-no-duplicate-headings", + "/remark-lint-no-heading-punctuation", + "/remark-lint-no-inline-padding", + "/remark-lint-no-literal-urls", + "/remark-preset-lint-markdown-style-guide/remark-lint-blockquote-indentation" + ], + "_resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "_shasum": "27055500103f51637bd07d01da01eb1967a43527", + "_spec": "mdast-util-to-string@^1.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-blockquote-indentation", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/mdast-util-to-string/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "mdast utility to get the plain text content of a node", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.4.0", + "tinyify": "^2.0.0", + "xo": "^0.27.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/mdast-util-to-string#readme", + "keywords": [ + "unist", + "mdast", + "mdast-util", + "util", + "utility", + "markdown", + "node", + "string", + "serialize" + ], + "license": "MIT", + "name": "mdast-util-to-string", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/mdast-util-to-string.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s mdastUtilToString > mdast-util-to-string.js", + "build-mangle": "browserify . -s mdastUtilToString -p tinyify > mdast-util-to-string.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.0", + "xo": { + "prettier": true, + "esnext": false, + "ignore": [ + "mdast-util-to-string.js" + ] + } +} diff --git a/node_modules/mdast-util-to-string/readme.md b/node_modules/mdast-util-to-string/readme.md new file mode 100644 index 00000000..f816fdde --- /dev/null +++ b/node_modules/mdast-util-to-string/readme.md @@ -0,0 +1,128 @@ +# mdast-util-to-string + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**mdast**][mdast] utility to get the plain text content of a node. + +## Install + +[npm][]: + +```sh +npm install mdast-util-to-string +``` + +## Use + +```js +var unified = require('unified') +var parse = require('remark-parse') +var toString = require('mdast-util-to-string') + +var tree = unified() + .use(parse) + .parse('Some _emphasis_, **importance**, and `code`.') + +console.log(toString(tree)) // => 'Some emphasis, importance, and code.' +``` + +## API + +### `toString(node)` + +Get the text content of a [node][]. + +The algorithm checks `value` of `node`, then `alt`, and finally `title`. +If no value is found, the algorithm checks the children of `node` and joins them +(without spaces or newlines). +If the given node is in fact a list of nodes, serializes them. + +> This is not a markdown to plain-text library. +> Use [`strip-markdown`][strip-markdown] for that. + +## Security + +Use of `mdast-util-to-string` does not involve [**hast**][hast], user content, +or change the tree, so there are no openings for +[cross-site scripting (XSS)][xss] attacks. + +## Related + +* [`nlcst-to-string`](https://github.com/syntax-tree/nlcst-to-string) + — Get text content in nlcst +* [`hast-util-to-string`](https://github.com/wooorm/rehype-minify/tree/master/packages/hast-util-to-string) + — Get text content in hast +* [`hast-util-to-text`](https://github.com/syntax-tree/hast-util-to-text) + — Get text content in hast according to the `innerText` algorithm +* [`hast-util-from-string`](https://github.com/wooorm/rehype-minify/tree/master/packages/hast-util-from-string) + — Set text content in hast + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/mdast-util-to-string.svg + +[build]: https://travis-ci.org/syntax-tree/mdast-util-to-string + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-string.svg + +[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-string + +[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-string.svg + +[downloads]: https://www.npmjs.com/package/mdast-util-to-string + +[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-to-string.svg + +[size]: https://bundlephobia.com/result?p=mdast-util-to-string + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/mdast#nodes + +[strip-markdown]: https://github.com/remarkjs/strip-markdown + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[hast]: https://github.com/syntax-tree/hast diff --git a/node_modules/micromatch/LICENSE b/node_modules/micromatch/LICENSE new file mode 100755 index 00000000..fa30c4cb --- /dev/null +++ b/node_modules/micromatch/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/micromatch/README.md b/node_modules/micromatch/README.md new file mode 100644 index 00000000..8fb39191 --- /dev/null +++ b/node_modules/micromatch/README.md @@ -0,0 +1,689 @@ +# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Build Status](https://img.shields.io/travis/jonschlinkert/micromatch.svg?style=flat)](https://travis-ci.org/jonschlinkert/micromatch) + +> Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. + +Micromatch supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch). + +* [mm()](#usage) is the same as [multimatch()](https://github.com/sindresorhus/multimatch) +* [mm.match()](#match) is the same as [minimatch.match()](https://github.com/isaacs/minimatch) +* use [mm.isMatch()](#ismatch) instead of [minimatch()](https://github.com/isaacs/minimatch) + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save micromatch +``` + +## Start matching! + +```js +var mm = require('micromatch'); +console.log(mm([''])) +``` + +*** + +### Features + +* [Drop-in replacement](#switch-from-minimatch) for [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch) +* Built-in support for multiple glob patterns, like `['foo/*.js', '!bar.js']` +* [Brace Expansion](https://github.com/jonschlinkert/braces) (`foo/bar-{1..5}.md`, `one/{two,three}/four.md`) +* Typical glob patterns, like `**/*`, `a/b/*.js`, or `['foo/*.js', '!bar.js']` +* Methods like `.isMatch()`, `.contains()` and `.any()` + +**Extended globbing features:** + +* Logical `OR` (`foo/bar/(abc|xyz).js`) +* Regex character classes (`foo/bar/baz-[1-5].js`) +* POSIX [bracket expressions](https://github.com/jonschlinkert/expand-brackets) (`**/[[:alpha:][:digit:]]/`) +* [extglobs](https://github.com/jonschlinkert/extglob) (`**/+(x|y)`, `!(a|b)`, etc). + +You can combine these to create whatever matching patterns you need. + +**Example** + +```js +// double-negation! +mm(['fa', 'fb', 'f', 'fo'], '!(f!(o))'); +//=> ['fo'] +``` + +## Why switch to micromatch? + +* Native support for multiple glob patterns, no need for wrappers like [multimatch](https://github.com/sindresorhus/multimatch) +* [10-55x faster](#benchmarks) and more performant than [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch). This is achieved through a combination of caching and regex optimization strategies, a fundamentally different approach than minimatch. +* More extensive support for the Bash 4.3 specification +* More complete extglob support +* Extensive [unit tests](./test) (approx. 1,300 tests). Minimatch fails many of the tests. + +### Switch from minimatch + +Use `mm.isMatch()` instead of `minimatch()`: + +```js +mm.isMatch('foo', 'b*'); +//=> false +``` + +Use `mm.match()` instead of `minimatch.match()`: + +```js +mm.match(['foo', 'bar'], 'b*'); +//=> 'bar' +``` + +### Switch from multimatch + +Same signature: + +```js +mm(['foo', 'bar', 'baz'], ['f*', '*z']); +//=> ['foo', 'baz'] +``` + +*** + +## Usage + +Add micromatch to your node.js project: + +```js +var mm = require('micromatch'); +``` + +**Signature** + +```js +mm(array_of_strings, glob_patterns[, options]); +``` + +**Example** + +```js +mm(['foo', 'bar', 'baz'], 'b*'); +//=> ['bar', 'baz'] +``` + +### Usage examples + +**Brace expansion** + +Match files with `.js` or `.txt` extensions. + +```js +mm(['a.js', 'b.md', 'c.txt'], '*.{js,txt}'); +//=> ['a.js', 'c.txt'] +``` + +**Extglobs** + +Match anything except for files with the `.md` extension. + +```js +mm(files, '**/*.!(md)'); + +//=> ['a.js', 'c.txt'] +``` + +**Multiple patterns** + +Match using an array of patterns. + +```js +mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']); +//=> ['a.md', 'c.txt'] +``` + +**Negation patterns:** + +Behavior is designed to be what users would expect, based on conventions that are already well-established. + +* [minimatch](https://github.com/isaacs/minimatch) behavior is used when the pattern is a string, so patterns are **inclusive by default**. +* [multimatch](https://github.com/sindresorhus/multimatch) behavior is used when an array of patterns is passed, so patterns are **exclusive by default**. + +```js +mm(['a.js', 'b.md', 'c.txt'], '!*.{js,txt}'); +//=> ['b.md'] + +mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.*', '!*.{js,txt}']); +//=> ['a.md', 'd.json'] +``` + +*** + +## API methods + +```js +var mm = require('micromatch'); +``` + +### .match + +```js +mm.match(array, globString); +``` + +Return an array of files that match the given glob pattern. Useful if you only need to use a single glob pattern. + +**Example** + +```js +mm.match(['ab', 'a/b', 'bb', 'b/c'], '?b'); +//=> ['ab', 'bb'] + +mm.match(['ab', 'a/b', 'bb', 'b/c'], '*/b'); +//=> ['a/b'] +``` + +### .isMatch + +```js +mm.isMatch(filepath, globString); +``` + +Returns true if a file path matches the given glob pattern. + +**Example** + +```js +mm.isMatch('.verb.md', '*.md'); +//=> false + +mm.isMatch('.verb.md', '*.md', {dot: true}); +//=> true +``` + +### .contains + +Returns true if any part of a file path matches the given glob pattern. Think of this is "has path" versus "is path". + +**Example** + +`.isMatch()` would return false for both of the following: + +```js +mm.contains('a/b/c', 'a/b'); +//=> true + +mm.contains('a/b/c', 'a/*'); +//=> true +``` + +### .matcher + +Returns a function for matching using the supplied pattern. e.g. create your own "matcher". The advantage of this method is that the pattern can be compiled outside of a loop. + +**Pattern** + +Can be any of the following: + +* `glob/string` +* `regex` +* `function` + +**Example** + +```js +var isMatch = mm.matcher('*.md'); +var files = []; + +['a.md', 'b.txt', 'c.md'].forEach(function(fp) { + if (isMatch(fp)) { + files.push(fp); + } +}); +``` + +### .filter + +Returns a function that can be passed to `Array#filter()`. + +**Params** + +* `patterns` **{String|Array}**: + +**Examples** + +Single glob: + +```js +var fn = mm.filter('*.md'); +['a.js', 'b.txt', 'c.md'].filter(fn); +//=> ['c.md'] + +var fn = mm.filter('[a-c]'); +['a', 'b', 'c', 'd', 'e'].filter(fn); +//=> ['a', 'b', 'c'] +``` + +Array of glob patterns: + +```js +var arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; + +var fn = mm.filter(['{1..10}', '![7-9]', '!{3..4}']); +arr.filter(fn); +//=> [1, 2, 5, 6, 10] +``` + +_(Internally this function generates the matching function by using the [matcher](#matcher) method. You can use the [matcher](#matcher) method directly to create your own filter function)_ + +### .any + +Returns true if a file path matches any of the given patterns. + +```js +mm.any(filepath, patterns, options); +``` + +**Params** + +* filepath `{String}`: The file path to test. +* patterns `{String|Array}`: One or more glob patterns +* options: `{Object}`: options to pass to the `.matcher()` method. + +**Example** + +```js +mm.any('abc', ['!*z']); +//=> true +mm.any('abc', ['a*', 'z*']); +//=> true +mm.any('abc', 'a*'); +//=> true +mm.any('abc', ['z*']); +//=> false +``` + +### .expand + +Returns an object with a regex-compatible string and tokens. + +```js +mm.expand('*.js'); + +// when `track` is enabled (for debugging), the `history` array is used +// to record each mutation to the glob pattern as it's converted to regex +{ options: { track: false, dot: undefined, makeRe: true, negated: false }, + pattern: '(.*\\/|^)bar\\/(?:(?!(?:^|\\/)\\.).)*?', + history: [], + tokens: + { path: + { whole: '**/bar/**', + dirname: '**/bar/', + filename: '**', + basename: '**', + extname: '', + ext: '' }, + is: + { glob: true, + negated: false, + globstar: true, + dotfile: false, + dotdir: false }, + match: {}, + original: '**/bar/**', + pattern: '**/bar/**', + base: '' } } +``` + +### .makeRe + +Create a regular expression for matching file paths based on the given pattern: + +```js +mm.makeRe('*.js'); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +## Options + +### options.unixify + +Normalize slashes in file paths and glob patterns to forward slashes. + +Type: `{Boolean}` + +Default: `undefined` on non-windows, `true` on windows. + +### options.dot + +Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `{Boolean}` + +Default: `false` + +### options.unescape + +Unescape slashes in glob patterns. Use cautiously, especially on windows. + +Type: `{Boolean}` + +Default: `undefined` + +**Example** + +```js +mm.isMatch('abc', '\\a\\b\\c', {unescape: true}); +//=> true +``` + +### options.nodupes + +Remove duplicate elements from the result array. + +Type: `{Boolean}` + +Default: `undefined` + +**Example** + +Example of using the `unescape` and `nodupes` options together: + +```js +mm.match(['abc', '\\a\\b\\c'], '\\a\\b\\c', {unescape: true}); +//=> ['abc', 'abc'] + +mm.match(['abc', '\\a\\b\\c'], '\\a\\b\\c', {unescape: true, nodupes: true}); +//=> ['abc'] +``` + +### options.matchBase + +Allow glob patterns without slashes to match a file path based on its basename. . Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `{Boolean}` + +Default: `false` + +**Example** + +```js +mm(['a/b.js', 'a/c.md'], '*.js'); +//=> [] + +mm(['a/b.js', 'a/c.md'], '*.js', {matchBase: true}); +//=> ['a/b.js'] +``` + +### options.nobraces + +Don't expand braces in glob patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch) `nobrace`. + +Type: `{Boolean}` + +Default: `undefined` + +See [braces](https://github.com/jonschlinkert/braces) for more information about extended brace expansion. + +### options.nobrackets + +Don't expand POSIX bracket expressions. + +Type: `{Boolean}` + +Default: `undefined` + +See [expand-brackets](https://github.com/jonschlinkert/expand-brackets) for more information about extended bracket expressions. + +### options.noextglob + +Don't expand extended globs. + +Type: `{Boolean}` + +Default: `undefined` + +See [extglob](https://github.com/jonschlinkert/extglob) for more information about extended globs. + +### options.nocase + +Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `{Boolean}` + +Default: `false` + +### options.nonegate + +Disallow negation (`!`) patterns. + +Type: `{Boolean}` + +Default: `false` + +### options.nonull + +If `true`, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `{Boolean}` + +Default: `false` + +### options.cache + +Cache the platform (e.g. `win32`) to prevent this from being looked up for every filepath. + +Type: `{Boolean}` + +Default: `true` + +*** + +## Other features + +Micromatch also supports the following. + +### Extended globbing + +#### extglobs + +Extended globbing, as described by the bash man page: + +| **pattern** | **regex equivalent** | **description** | +| --- | --- | --- | +| `?(pattern-list)` | `(... | ...)?` | Matches zero or one occurrence of the given patterns | +| `*(pattern-list)` | `(... | ...)*` | Matches zero or more occurrences of the given patterns | +| `+(pattern-list)` | `(... | ...)+` | Matches one or more occurrences of the given patterns | +| `@(pattern-list)` | `(... | ...)` * | Matches one of the given patterns | +| `!(pattern-list)` | N/A | Matches anything except one of the given patterns | + +* `@` isn't a RegEx character. + +Powered by [extglob](https://github.com/jonschlinkert/extglob). Visit that library for the full range of options or to report extglob related issues. + +See [extglob](https://github.com/jonschlinkert/extglob) for more information about extended globs. + +#### brace expansion + +In simple cases, brace expansion appears to work the same way as the logical `OR` operator. For example, `(a|b)` will achieve the same result as `{a,b}`. + +Here are some powerful features unique to brace expansion (versus character classes): + +* range expansion: `a{1..3}b/*.js` expands to: `['a1b/*.js', 'a2b/*.js', 'a3b/*.js']` +* nesting: `a{c,{d,e}}b/*.js` expands to: `['acb/*.js', 'adb/*.js', 'aeb/*.js']` + +Visit [braces](https://github.com/jonschlinkert/braces) to ask questions and create an issue related to brace-expansion, or to see the full range of features and options related to brace expansion. + +#### regex character classes + +With the exception of brace expansion (`{a,b}`, `{1..5}`, etc), most of the special characters convert directly to regex, so you can expect them to follow the same rules and produce the same results as regex. + +For example, given the list: `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: + +* `[ac].js`: matches both `a` and `c`, returning `['a.js', 'c.js']` +* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']` +* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']` +* `a/[A-Z].js`: matches and uppercase letter, returning `['a/E.md']` + +Learn about [regex character classes](http://www.regular-expressions.info/charclass.html). + +#### regex groups + +Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: + +* `(a|c).js`: would match either `a` or `c`, returning `['a.js', 'c.js']` +* `(b|d).js`: would match either `b` or `d`, returning `['b.js', 'd.js']` +* `(b|[A-Z]).js`: would match either `b` or an uppercase letter, returning `['b.js', 'E.js']` + +As with regex, parenthese can be nested, so patterns like `((a|b)|c)/b` will work. But it might be easier to achieve your goal using brace expansion. + +#### POSIX bracket expressions + +**Example** + +```js +mm.isMatch('a1', '[[:alpha:][:digit:]]'); +//=> true +``` + +See [expand-brackets](https://github.com/jonschlinkert/expand-brackets) for more information about extended bracket expressions. + +*** + +## Notes + +Whenever possible parsing behavior for patterns is based on globbing specifications in Bash 4.3. Patterns that aren't described by Bash follow wildmatch spec (used by git). + +## Benchmarks + +Run the [benchmarks](./benchmark): + +```bash +node benchmark +``` + +As of July 15, 2016: + +```bash +#1: basename-braces + micromatch x 26,420 ops/sec ±0.89% (91 runs sampled) + minimatch x 3,507 ops/sec ±0.64% (97 runs sampled) + +#2: basename + micromatch x 25,315 ops/sec ±0.82% (93 runs sampled) + minimatch x 4,398 ops/sec ±0.86% (94 runs sampled) + +#3: braces-no-glob + micromatch x 341,254 ops/sec ±0.78% (93 runs sampled) + minimatch x 30,197 ops/sec ±1.12% (91 runs sampled) + +#4: braces + micromatch x 54,649 ops/sec ±0.74% (94 runs sampled) + minimatch x 3,095 ops/sec ±0.82% (95 runs sampled) + +#5: immediate + micromatch x 16,719 ops/sec ±0.79% (95 runs sampled) + minimatch x 4,348 ops/sec ±0.86% (96 runs sampled) + +#6: large + micromatch x 721 ops/sec ±0.77% (94 runs sampled) + minimatch x 17.73 ops/sec ±1.08% (50 runs sampled) + +#7: long + micromatch x 5,051 ops/sec ±0.87% (97 runs sampled) + minimatch x 628 ops/sec ±0.83% (94 runs sampled) + +#8: mid + micromatch x 51,280 ops/sec ±0.80% (95 runs sampled) + minimatch x 1,923 ops/sec ±0.84% (95 runs sampled) + +#9: multi-patterns + micromatch x 22,440 ops/sec ±0.97% (94 runs sampled) + minimatch x 2,481 ops/sec ±1.10% (94 runs sampled) + +#10: no-glob + micromatch x 722,823 ops/sec ±1.30% (87 runs sampled) + minimatch x 52,967 ops/sec ±1.09% (94 runs sampled) + +#11: range + micromatch x 243,471 ops/sec ±0.79% (94 runs sampled) + minimatch x 11,736 ops/sec ±0.82% (96 runs sampled) + +#12: shallow + micromatch x 190,874 ops/sec ±0.98% (95 runs sampled) + minimatch x 21,699 ops/sec ±0.81% (97 runs sampled) + +#13: short + micromatch x 496,393 ops/sec ±3.86% (90 runs sampled) + minimatch x 53,765 ops/sec ±0.75% (95 runs sampled) +``` + +## Tests + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Coverage + +As of July 15, 2016: + +```sh +Statements : 100% (441/441) +Branches : 100% (270/270) +Functions : 100% (54/54) +Lines : 100% (429/429) +``` + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please be sure to run the benchmarks before/after any code changes to judge the impact before you do a PR. thanks! + +## Related + +* [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.") +* [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.") +* [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.") +* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier 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 multiplier to use.") +* [gulp-micromatch](https://www.npmjs.com/package/gulp-micromatch): Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream. | [homepage](https://github.com/tunnckocore/gulp-micromatch#readme "Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream.") +* [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") +* [parse-glob](https://www.npmjs.com/package/parse-glob): Parse a glob pattern into an object of tokens. | [homepage](https://github.com/jonschlinkert/parse-glob "Parse a glob pattern into an object of tokens.") + +## 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/micromatch/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 15, 2016._ \ No newline at end of file diff --git a/node_modules/micromatch/index.js b/node_modules/micromatch/index.js new file mode 100755 index 00000000..f898ec17 --- /dev/null +++ b/node_modules/micromatch/index.js @@ -0,0 +1,431 @@ +/*! + * micromatch + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var expand = require('./lib/expand'); +var utils = require('./lib/utils'); + +/** + * The main function. Pass an array of filepaths, + * and a string or array of glob patterns + * + * @param {Array|String} `files` + * @param {Array|String} `patterns` + * @param {Object} `opts` + * @return {Array} Array of matches + */ + +function micromatch(files, patterns, opts) { + if (!files || !patterns) return []; + opts = opts || {}; + + if (typeof opts.cache === 'undefined') { + opts.cache = true; + } + + if (!Array.isArray(patterns)) { + return match(files, patterns, opts); + } + + var len = patterns.length, i = 0; + var omit = [], keep = []; + + while (len--) { + var glob = patterns[i++]; + if (typeof glob === 'string' && glob.charCodeAt(0) === 33 /* ! */) { + omit.push.apply(omit, match(files, glob.slice(1), opts)); + } else { + keep.push.apply(keep, match(files, glob, opts)); + } + } + return utils.diff(keep, omit); +} + +/** + * Return an array of files that match the given glob pattern. + * + * This function is called by the main `micromatch` function If you only + * need to pass a single pattern you might get very minor speed improvements + * using this function. + * + * @param {Array} `files` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Array} + */ + +function match(files, pattern, opts) { + if (utils.typeOf(files) !== 'string' && !Array.isArray(files)) { + throw new Error(msg('match', 'files', 'a string or array')); + } + + files = utils.arrayify(files); + opts = opts || {}; + + var negate = opts.negate || false; + var orig = pattern; + + if (typeof pattern === 'string') { + negate = pattern.charAt(0) === '!'; + if (negate) { + pattern = pattern.slice(1); + } + + // we need to remove the character regardless, + // so the above logic is still needed + if (opts.nonegate === true) { + negate = false; + } + } + + var _isMatch = matcher(pattern, opts); + var len = files.length, i = 0; + var res = []; + + while (i < len) { + var file = files[i++]; + var fp = utils.unixify(file, opts); + + if (!_isMatch(fp)) { continue; } + res.push(fp); + } + + if (res.length === 0) { + if (opts.failglob === true) { + throw new Error('micromatch.match() found no matches for: "' + orig + '".'); + } + + if (opts.nonull || opts.nullglob) { + res.push(utils.unescapeGlob(orig)); + } + } + + // if `negate` was defined, diff negated files + if (negate) { res = utils.diff(files, res); } + + // if `ignore` was defined, diff ignored filed + if (opts.ignore && opts.ignore.length) { + pattern = opts.ignore; + opts = utils.omit(opts, ['ignore']); + res = utils.diff(res, micromatch(res, pattern, opts)); + } + + if (opts.nodupes) { + return utils.unique(res); + } + return res; +} + +/** + * Returns a function that takes a glob pattern or array of glob patterns + * to be used with `Array#filter()`. (Internally this function generates + * the matching function using the [matcher] method). + * + * ```js + * var fn = mm.filter('[a-c]'); + * ['a', 'b', 'c', 'd', 'e'].filter(fn); + * //=> ['a', 'b', 'c'] + * ``` + * @param {String|Array} `patterns` Can be a glob or array of globs. + * @param {Options} `opts` Options to pass to the [matcher] method. + * @return {Function} Filter function to be passed to `Array#filter()`. + */ + +function filter(patterns, opts) { + if (!Array.isArray(patterns) && typeof patterns !== 'string') { + throw new TypeError(msg('filter', 'patterns', 'a string or array')); + } + + patterns = utils.arrayify(patterns); + var len = patterns.length, i = 0; + var patternMatchers = Array(len); + while (i < len) { + patternMatchers[i] = matcher(patterns[i++], opts); + } + + return function(fp) { + if (fp == null) return []; + var len = patternMatchers.length, i = 0; + var res = true; + + fp = utils.unixify(fp, opts); + while (i < len) { + var fn = patternMatchers[i++]; + if (!fn(fp)) { + res = false; + break; + } + } + return res; + }; +} + +/** + * Returns true if the filepath contains the given + * pattern. Can also return a function for matching. + * + * ```js + * isMatch('foo.md', '*.md', {}); + * //=> true + * + * isMatch('*.md', {})('foo.md') + * //=> true + * ``` + * @param {String} `fp` + * @param {String} `pattern` + * @param {Object} `opts` + * @return {Boolean} + */ + +function isMatch(fp, pattern, opts) { + if (typeof fp !== 'string') { + throw new TypeError(msg('isMatch', 'filepath', 'a string')); + } + + fp = utils.unixify(fp, opts); + if (utils.typeOf(pattern) === 'object') { + return matcher(fp, pattern); + } + return matcher(pattern, opts)(fp); +} + +/** + * Returns true if the filepath matches the + * given pattern. + */ + +function contains(fp, pattern, opts) { + if (typeof fp !== 'string') { + throw new TypeError(msg('contains', 'pattern', 'a string')); + } + + opts = opts || {}; + opts.contains = (pattern !== ''); + fp = utils.unixify(fp, opts); + + if (opts.contains && !utils.isGlob(pattern)) { + return fp.indexOf(pattern) !== -1; + } + return matcher(pattern, opts)(fp); +} + +/** + * Returns true if a file path matches any of the + * given patterns. + * + * @param {String} `fp` The filepath to test. + * @param {String|Array} `patterns` Glob patterns to use. + * @param {Object} `opts` Options to pass to the `matcher()` function. + * @return {String} + */ + +function any(fp, patterns, opts) { + if (!Array.isArray(patterns) && typeof patterns !== 'string') { + throw new TypeError(msg('any', 'patterns', 'a string or array')); + } + + patterns = utils.arrayify(patterns); + var len = patterns.length; + + fp = utils.unixify(fp, opts); + while (len--) { + var isMatch = matcher(patterns[len], opts); + if (isMatch(fp)) { + return true; + } + } + return false; +} + +/** + * Filter the keys of an object with the given `glob` pattern + * and `options` + * + * @param {Object} `object` + * @param {Pattern} `object` + * @return {Array} + */ + +function matchKeys(obj, glob, options) { + if (utils.typeOf(obj) !== 'object') { + throw new TypeError(msg('matchKeys', 'first argument', 'an object')); + } + + var fn = matcher(glob, options); + var res = {}; + + for (var key in obj) { + if (obj.hasOwnProperty(key) && fn(key)) { + res[key] = obj[key]; + } + } + return res; +} + +/** + * Return a function for matching based on the + * given `pattern` and `options`. + * + * @param {String} `pattern` + * @param {Object} `options` + * @return {Function} + */ + +function matcher(pattern, opts) { + // pattern is a function + if (typeof pattern === 'function') { + return pattern; + } + // pattern is a regex + if (pattern instanceof RegExp) { + return function(fp) { + return pattern.test(fp); + }; + } + + if (typeof pattern !== 'string') { + throw new TypeError(msg('matcher', 'pattern', 'a string, regex, or function')); + } + + // strings, all the way down... + pattern = utils.unixify(pattern, opts); + + // pattern is a non-glob string + if (!utils.isGlob(pattern)) { + return utils.matchPath(pattern, opts); + } + // pattern is a glob string + var re = makeRe(pattern, opts); + + // `matchBase` is defined + if (opts && opts.matchBase) { + return utils.hasFilename(re, opts); + } + // `matchBase` is not defined + return function(fp) { + fp = utils.unixify(fp, opts); + return re.test(fp); + }; +} + +/** + * Create and cache a regular expression for matching + * file paths. + * + * If the leading character in the `glob` is `!`, a negation + * regex is returned. + * + * @param {String} `glob` + * @param {Object} `options` + * @return {RegExp} + */ + +function toRegex(glob, options) { + // clone options to prevent mutating the original object + var opts = Object.create(options || {}); + var flags = opts.flags || ''; + if (opts.nocase && flags.indexOf('i') === -1) { + flags += 'i'; + } + + var parsed = expand(glob, opts); + + // pass in tokens to avoid parsing more than once + opts.negated = opts.negated || parsed.negated; + opts.negate = opts.negated; + glob = wrapGlob(parsed.pattern, opts); + var re; + + try { + re = new RegExp(glob, flags); + return re; + } catch (err) { + err.reason = 'micromatch invalid regex: (' + re + ')'; + if (opts.strict) throw new SyntaxError(err); + } + + // we're only here if a bad pattern was used and the user + // passed `options.silent`, so match nothing + return /$^/; +} + +/** + * Create the regex to do the matching. If the leading + * character in the `glob` is `!` a negation regex is returned. + * + * @param {String} `glob` + * @param {Boolean} `negate` + */ + +function wrapGlob(glob, opts) { + var prefix = (opts && !opts.contains) ? '^' : ''; + var after = (opts && !opts.contains) ? '$' : ''; + glob = ('(?:' + glob + ')' + after); + if (opts && opts.negate) { + return prefix + ('(?!^' + glob + ').*$'); + } + return prefix + glob; +} + +/** + * Create and cache a regular expression for matching file paths. + * If the leading character in the `glob` is `!`, a negation + * regex is returned. + * + * @param {String} `glob` + * @param {Object} `options` + * @return {RegExp} + */ + +function makeRe(glob, opts) { + if (utils.typeOf(glob) !== 'string') { + throw new Error(msg('makeRe', 'glob', 'a string')); + } + return utils.cache(toRegex, glob, opts); +} + +/** + * Make error messages consistent. Follows this format: + * + * ```js + * msg(methodName, argNumber, nativeType); + * // example: + * msg('matchKeys', 'first', 'an object'); + * ``` + * + * @param {String} `method` + * @param {String} `num` + * @param {String} `type` + * @return {String} + */ + +function msg(method, what, type) { + return 'micromatch.' + method + '(): ' + what + ' should be ' + type + '.'; +} + +/** + * Public methods + */ + +/* eslint no-multi-spaces: 0 */ +micromatch.any = any; +micromatch.braces = micromatch.braceExpand = utils.braces; +micromatch.contains = contains; +micromatch.expand = expand; +micromatch.filter = filter; +micromatch.isMatch = isMatch; +micromatch.makeRe = makeRe; +micromatch.match = match; +micromatch.matcher = matcher; +micromatch.matchKeys = matchKeys; + +/** + * Expose `micromatch` + */ + +module.exports = micromatch; diff --git a/node_modules/micromatch/lib/chars.js b/node_modules/micromatch/lib/chars.js new file mode 100644 index 00000000..a1ffe371 --- /dev/null +++ b/node_modules/micromatch/lib/chars.js @@ -0,0 +1,67 @@ +'use strict'; + +var chars = {}, unesc, temp; + +function reverse(object, prepender) { + return Object.keys(object).reduce(function(reversed, key) { + var newKey = prepender ? prepender + key : key; // Optionally prepend a string to key. + reversed[object[key]] = newKey; // Swap key and value. + return reversed; // Return the result. + }, {}); +} + +/** + * Regex for common characters + */ + +chars.escapeRegex = { + '?': /\?/g, + '@': /\@/g, + '!': /\!/g, + '+': /\+/g, + '*': /\*/g, + '(': /\(/g, + ')': /\)/g, + '[': /\[/g, + ']': /\]/g +}; + +/** + * Escape characters + */ + +chars.ESC = { + '?': '__UNESC_QMRK__', + '@': '__UNESC_AMPE__', + '!': '__UNESC_EXCL__', + '+': '__UNESC_PLUS__', + '*': '__UNESC_STAR__', + ',': '__UNESC_COMMA__', + '(': '__UNESC_LTPAREN__', + ')': '__UNESC_RTPAREN__', + '[': '__UNESC_LTBRACK__', + ']': '__UNESC_RTBRACK__' +}; + +/** + * Unescape characters + */ + +chars.UNESC = unesc || (unesc = reverse(chars.ESC, '\\')); + +chars.ESC_TEMP = { + '?': '__TEMP_QMRK__', + '@': '__TEMP_AMPE__', + '!': '__TEMP_EXCL__', + '*': '__TEMP_STAR__', + '+': '__TEMP_PLUS__', + ',': '__TEMP_COMMA__', + '(': '__TEMP_LTPAREN__', + ')': '__TEMP_RTPAREN__', + '[': '__TEMP_LTBRACK__', + ']': '__TEMP_RTBRACK__' +}; + +chars.TEMP = temp || (temp = reverse(chars.ESC_TEMP)); + +module.exports = chars; diff --git a/node_modules/micromatch/lib/expand.js b/node_modules/micromatch/lib/expand.js new file mode 100644 index 00000000..e99b081e --- /dev/null +++ b/node_modules/micromatch/lib/expand.js @@ -0,0 +1,304 @@ +/*! + * micromatch + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var utils = require('./utils'); +var Glob = require('./glob'); + +/** + * Expose `expand` + */ + +module.exports = expand; + +/** + * Expand a glob pattern to resolve braces and + * similar patterns before converting to regex. + * + * @param {String|Array} `pattern` + * @param {Array} `files` + * @param {Options} `opts` + * @return {Array} + */ + +function expand(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('micromatch.expand(): argument should be a string.'); + } + + var glob = new Glob(pattern, options || {}); + var opts = glob.options; + + if (!utils.isGlob(pattern)) { + glob.pattern = glob.pattern.replace(/([\/.])/g, '\\$1'); + return glob; + } + + glob.pattern = glob.pattern.replace(/(\+)(?!\()/g, '\\$1'); + glob.pattern = glob.pattern.split('$').join('\\$'); + + if (typeof opts.braces !== 'boolean' && typeof opts.nobraces !== 'boolean') { + opts.braces = true; + } + + if (glob.pattern === '.*') { + return { + pattern: '\\.' + star, + tokens: tok, + options: opts + }; + } + + if (glob.pattern === '*') { + return { + pattern: oneStar(opts.dot), + tokens: tok, + options: opts + }; + } + + // parse the glob pattern into tokens + glob.parse(); + var tok = glob.tokens; + tok.is.negated = opts.negated; + + // dotfile handling + if ((opts.dotfiles === true || tok.is.dotfile) && opts.dot !== false) { + opts.dotfiles = true; + opts.dot = true; + } + + if ((opts.dotdirs === true || tok.is.dotdir) && opts.dot !== false) { + opts.dotdirs = true; + opts.dot = true; + } + + // check for braces with a dotfile pattern + if (/[{,]\./.test(glob.pattern)) { + opts.makeRe = false; + opts.dot = true; + } + + if (opts.nonegate !== true) { + opts.negated = glob.negated; + } + + // if the leading character is a dot or a slash, escape it + if (glob.pattern.charAt(0) === '.' && glob.pattern.charAt(1) !== '/') { + glob.pattern = '\\' + glob.pattern; + } + + /** + * Extended globs + */ + + // expand braces, e.g `{1..5}` + glob.track('before braces'); + if (tok.is.braces) { + glob.braces(); + } + glob.track('after braces'); + + // expand extglobs, e.g `foo/!(a|b)` + glob.track('before extglob'); + if (tok.is.extglob) { + glob.extglob(); + } + glob.track('after extglob'); + + // expand brackets, e.g `[[:alpha:]]` + glob.track('before brackets'); + if (tok.is.brackets) { + glob.brackets(); + } + glob.track('after brackets'); + + // special patterns + glob._replace('[!', '[^'); + glob._replace('(?', '(%~'); + glob._replace(/\[\]/, '\\[\\]'); + glob._replace('/[', '/' + (opts.dot ? dotfiles : nodot) + '[', true); + glob._replace('/?', '/' + (opts.dot ? dotfiles : nodot) + '[^/]', true); + glob._replace('/.', '/(?=.)\\.', true); + + // windows drives + glob._replace(/^(\w):([\\\/]+?)/gi, '(?=.)$1:$2', true); + + // negate slashes in exclusion ranges + if (glob.pattern.indexOf('[^') !== -1) { + glob.pattern = negateSlash(glob.pattern); + } + + if (opts.globstar !== false && glob.pattern === '**') { + glob.pattern = globstar(opts.dot); + + } else { + glob.pattern = balance(glob.pattern, '[', ']'); + glob.escape(glob.pattern); + + // if the pattern has `**` + if (tok.is.globstar) { + glob.pattern = collapse(glob.pattern, '/**'); + glob.pattern = collapse(glob.pattern, '**/'); + glob._replace('/**/', '(?:/' + globstar(opts.dot) + '/|/)', true); + glob._replace(/\*{2,}/g, '**'); + + // 'foo/*' + glob._replace(/(\w+)\*(?!\/)/g, '$1[^/]*?', true); + glob._replace(/\*\*\/\*(\w)/g, globstar(opts.dot) + '\\/' + (opts.dot ? dotfiles : nodot) + '[^/]*?$1', true); + + if (opts.dot !== true) { + glob._replace(/\*\*\/(.)/g, '(?:**\\/|)$1'); + } + + // 'foo/**' or '{**,*}', but not 'foo**' + if (tok.path.dirname !== '' || /,\*\*|\*\*,/.test(glob.orig)) { + glob._replace('**', globstar(opts.dot), true); + } + } + + // ends with /* + glob._replace(/\/\*$/, '\\/' + oneStar(opts.dot), true); + // ends with *, no slashes + glob._replace(/(?!\/)\*$/, star, true); + // has 'n*.' (partial wildcard w/ file extension) + glob._replace(/([^\/]+)\*/, '$1' + oneStar(true), true); + // has '*' + glob._replace('*', oneStar(opts.dot), true); + glob._replace('?.', '?\\.', true); + glob._replace('?:', '?:', true); + + glob._replace(/\?+/g, function(match) { + var len = match.length; + if (len === 1) { + return qmark; + } + return qmark + '{' + len + '}'; + }); + + // escape '.abc' => '\\.abc' + glob._replace(/\.([*\w]+)/g, '\\.$1'); + // fix '[^\\\\/]' + glob._replace(/\[\^[\\\/]+\]/g, qmark); + // '///' => '\/' + glob._replace(/\/+/g, '\\/'); + // '\\\\\\' => '\\' + glob._replace(/\\{2,}/g, '\\'); + } + + // unescape previously escaped patterns + glob.unescape(glob.pattern); + glob._replace('__UNESC_STAR__', '*'); + + // escape dots that follow qmarks + glob._replace('?.', '?\\.'); + + // remove unnecessary slashes in character classes + glob._replace('[^\\/]', qmark); + + if (glob.pattern.length > 1) { + if (/^[\[?*]/.test(glob.pattern)) { + // only prepend the string if we don't want to match dotfiles + glob.pattern = (opts.dot ? dotfiles : nodot) + glob.pattern; + } + } + + return glob; +} + +/** + * Collapse repeated character sequences. + * + * ```js + * collapse('a/../../../b', '../'); + * //=> 'a/../b' + * ``` + * + * @param {String} `str` + * @param {String} `ch` Character sequence to collapse + * @return {String} + */ + +function collapse(str, ch) { + var res = str.split(ch); + var isFirst = res[0] === ''; + var isLast = res[res.length - 1] === ''; + res = res.filter(Boolean); + if (isFirst) res.unshift(''); + if (isLast) res.push(''); + return res.join(ch); +} + +/** + * Negate slashes in exclusion ranges, per glob spec: + * + * ```js + * negateSlash('[^foo]'); + * //=> '[^\\/foo]' + * ``` + * + * @param {String} `str` glob pattern + * @return {String} + */ + +function negateSlash(str) { + return str.replace(/\[\^([^\]]*?)\]/g, function(match, inner) { + if (inner.indexOf('/') === -1) { + inner = '\\/' + inner; + } + return '[^' + inner + ']'; + }); +} + +/** + * Escape imbalanced braces/bracket. This is a very + * basic, naive implementation that only does enough + * to serve the purpose. + */ + +function balance(str, a, b) { + var aarr = str.split(a); + var alen = aarr.join('').length; + var blen = str.split(b).join('').length; + + if (alen !== blen) { + str = aarr.join('\\' + a); + return str.split(b).join('\\' + b); + } + return str; +} + +/** + * Special patterns to be converted to regex. + * Heuristics are used to simplify patterns + * and speed up processing. + */ + +/* eslint no-multi-spaces: 0 */ +var qmark = '[^/]'; +var star = qmark + '*?'; +var nodot = '(?!\\.)(?=.)'; +var dotfileGlob = '(?:\\/|^)\\.{1,2}($|\\/)'; +var dotfiles = '(?!' + dotfileGlob + ')(?=.)'; +var twoStarDot = '(?:(?!' + dotfileGlob + ').)*?'; + +/** + * Create a regex for `*`. + * + * If `dot` is true, or the pattern does not begin with + * a leading star, then return the simpler regex. + */ + +function oneStar(dotfile) { + return dotfile ? '(?!' + dotfileGlob + ')(?=.)' + star : (nodot + star); +} + +function globstar(dotfile) { + if (dotfile) { return twoStarDot; } + return '(?:(?!(?:\\/|^)\\.).)*?'; +} diff --git a/node_modules/micromatch/lib/glob.js b/node_modules/micromatch/lib/glob.js new file mode 100644 index 00000000..c6133267 --- /dev/null +++ b/node_modules/micromatch/lib/glob.js @@ -0,0 +1,193 @@ +'use strict'; + +var chars = require('./chars'); +var utils = require('./utils'); + +/** + * Expose `Glob` + */ + +var Glob = module.exports = function Glob(pattern, options) { + if (!(this instanceof Glob)) { + return new Glob(pattern, options); + } + this.options = options || {}; + this.pattern = pattern; + this.history = []; + this.tokens = {}; + this.init(pattern); +}; + +/** + * Initialize defaults + */ + +Glob.prototype.init = function(pattern) { + this.orig = pattern; + this.negated = this.isNegated(); + this.options.track = this.options.track || false; + this.options.makeRe = true; +}; + +/** + * Push a change into `glob.history`. Useful + * for debugging. + */ + +Glob.prototype.track = function(msg) { + if (this.options.track) { + this.history.push({msg: msg, pattern: this.pattern}); + } +}; + +/** + * Return true if `glob.pattern` was negated + * with `!`, also remove the `!` from the pattern. + * + * @return {Boolean} + */ + +Glob.prototype.isNegated = function() { + if (this.pattern.charCodeAt(0) === 33 /* '!' */) { + this.pattern = this.pattern.slice(1); + return true; + } + return false; +}; + +/** + * Expand braces in the given glob pattern. + * + * We only need to use the [braces] lib when + * patterns are nested. + */ + +Glob.prototype.braces = function() { + if (this.options.nobraces !== true && this.options.nobrace !== true) { + // naive/fast check for imbalanced characters + var a = this.pattern.match(/[\{\(\[]/g); + var b = this.pattern.match(/[\}\)\]]/g); + + // if imbalanced, don't optimize the pattern + if (a && b && (a.length !== b.length)) { + this.options.makeRe = false; + } + + // expand brace patterns and join the resulting array + var expanded = utils.braces(this.pattern, this.options); + this.pattern = expanded.join('|'); + } +}; + +/** + * Expand bracket expressions in `glob.pattern` + */ + +Glob.prototype.brackets = function() { + if (this.options.nobrackets !== true) { + this.pattern = utils.brackets(this.pattern); + } +}; + +/** + * Expand bracket expressions in `glob.pattern` + */ + +Glob.prototype.extglob = function() { + if (this.options.noextglob === true) return; + + if (utils.isExtglob(this.pattern)) { + this.pattern = utils.extglob(this.pattern, {escape: true}); + } +}; + +/** + * Parse the given pattern + */ + +Glob.prototype.parse = function(pattern) { + this.tokens = utils.parseGlob(pattern || this.pattern, true); + return this.tokens; +}; + +/** + * Replace `a` with `b`. Also tracks the change before and + * after each replacement. This is disabled by default, but + * can be enabled by setting `options.track` to true. + * + * Also, when the pattern is a string, `.split()` is used, + * because it's much faster than replace. + * + * @param {RegExp|String} `a` + * @param {String} `b` + * @param {Boolean} `escape` When `true`, escapes `*` and `?` in the replacement. + * @return {String} + */ + +Glob.prototype._replace = function(a, b, escape) { + this.track('before (find): "' + a + '" (replace with): "' + b + '"'); + if (escape) b = esc(b); + if (a && b && typeof a === 'string') { + this.pattern = this.pattern.split(a).join(b); + } else { + this.pattern = this.pattern.replace(a, b); + } + this.track('after'); +}; + +/** + * Escape special characters in the given string. + * + * @param {String} `str` Glob pattern + * @return {String} + */ + +Glob.prototype.escape = function(str) { + this.track('before escape: '); + var re = /["\\](['"]?[^"'\\]['"]?)/g; + + this.pattern = str.replace(re, function($0, $1) { + var o = chars.ESC; + var ch = o && o[$1]; + if (ch) { + return ch; + } + if (/[a-z]/i.test($0)) { + return $0.split('\\').join(''); + } + return $0; + }); + + this.track('after escape: '); +}; + +/** + * Unescape special characters in the given string. + * + * @param {String} `str` + * @return {String} + */ + +Glob.prototype.unescape = function(str) { + var re = /__([A-Z]+)_([A-Z]+)__/g; + this.pattern = str.replace(re, function($0, $1) { + return chars[$1][$0]; + }); + this.pattern = unesc(this.pattern); +}; + +/** + * Escape/unescape utils + */ + +function esc(str) { + str = str.split('?').join('%~'); + str = str.split('*').join('%%'); + return str; +} + +function unesc(str) { + str = str.split('%~').join('?'); + str = str.split('%%').join('*'); + return str; +} diff --git a/node_modules/micromatch/lib/utils.js b/node_modules/micromatch/lib/utils.js new file mode 100644 index 00000000..7c24a510 --- /dev/null +++ b/node_modules/micromatch/lib/utils.js @@ -0,0 +1,149 @@ +'use strict'; + +var win32 = process && process.platform === 'win32'; +var path = require('path'); +var fileRe = require('filename-regex'); +var utils = module.exports; + +/** + * Module dependencies + */ + +utils.diff = require('arr-diff'); +utils.unique = require('array-unique'); +utils.braces = require('braces'); +utils.brackets = require('expand-brackets'); +utils.extglob = require('extglob'); +utils.isExtglob = require('is-extglob'); +utils.isGlob = require('is-glob'); +utils.typeOf = require('kind-of'); +utils.normalize = require('normalize-path'); +utils.omit = require('object.omit'); +utils.parseGlob = require('parse-glob'); +utils.cache = require('regex-cache'); + +/** + * Get the filename of a filepath + * + * @param {String} `string` + * @return {String} + */ + +utils.filename = function filename(fp) { + var seg = fp.match(fileRe()); + return seg && seg[0]; +}; + +/** + * Returns a function that returns true if the given + * pattern is the same as a given `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.isPath = function isPath(pattern, opts) { + opts = opts || {}; + return function(fp) { + var unixified = utils.unixify(fp, opts); + if(opts.nocase){ + return pattern.toLowerCase() === unixified.toLowerCase(); + } + return pattern === unixified; + }; +}; + +/** + * Returns a function that returns true if the given + * pattern contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.hasPath = function hasPath(pattern, opts) { + return function(fp) { + return utils.unixify(pattern, opts).indexOf(fp) !== -1; + }; +}; + +/** + * Returns a function that returns true if the given + * pattern matches or contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.matchPath = function matchPath(pattern, opts) { + var fn = (opts && opts.contains) + ? utils.hasPath(pattern, opts) + : utils.isPath(pattern, opts); + return fn; +}; + +/** + * Returns a function that returns true if the given + * regex matches the `filename` of a file path. + * + * @param {RegExp} `re` + * @return {Boolean} + */ + +utils.hasFilename = function hasFilename(re) { + return function(fp) { + var name = utils.filename(fp); + return name && re.test(name); + }; +}; + +/** + * Coerce `val` to an array + * + * @param {*} val + * @return {Array} + */ + +utils.arrayify = function arrayify(val) { + return !Array.isArray(val) + ? [val] + : val; +}; + +/** + * Normalize all slashes in a file path or glob pattern to + * forward slashes. + */ + +utils.unixify = function unixify(fp, opts) { + if (opts && opts.unixify === false) return fp; + if (opts && opts.unixify === true || win32 || path.sep === '\\') { + return utils.normalize(fp, false); + } + if (opts && opts.unescape === true) { + return fp ? fp.toString().replace(/\\(\w)/g, '$1') : ''; + } + return fp; +}; + +/** + * Escape/unescape utils + */ + +utils.escapePath = function escapePath(fp) { + return fp.replace(/[\\.]/g, '\\$&'); +}; + +utils.unescapeGlob = function unescapeGlob(fp) { + return fp.replace(/[\\"']/g, ''); +}; + +utils.escapeRe = function escapeRe(str) { + return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&'); +}; + +/** + * Expose `utils` + */ + +module.exports = utils; diff --git a/node_modules/micromatch/package.json b/node_modules/micromatch/package.json new file mode 100644 index 00000000..6032b886 --- /dev/null +++ b/node_modules/micromatch/package.json @@ -0,0 +1,145 @@ +{ + "_from": "micromatch@^2.1.5", + "_id": "micromatch@2.3.11", + "_inBundle": false, + "_integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "_location": "/micromatch", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "micromatch@^2.1.5", + "name": "micromatch", + "escapedName": "micromatch", + "rawSpec": "^2.1.5", + "saveSpec": null, + "fetchSpec": "^2.1.5" + }, + "_requiredBy": [ + "/anymatch" + ], + "_resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "_shasum": "86677c97d1720b363431d04d0d15293bd38c1565", + "_spec": "micromatch@^2.1.5", + "_where": "/home/remi/github/CPP_BIDS/node_modules/anymatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/micromatch/issues" + }, + "bundleDependencies": false, + "dependencies": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + }, + "deprecated": false, + "description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.", + "devDependencies": { + "benchmarked": "^0.1.4", + "chalk": "^1.1.1", + "gulp": "^3.9.0", + "gulp-eslint": "^1.1.1", + "gulp-format-md": "^0.1.8", + "gulp-istanbul": "^0.10.1", + "gulp-mocha": "^2.1.3", + "minimatch": "^3.0.0", + "minimist": "^1.2.0", + "mocha": "^2", + "multimatch": "^2.0.0", + "should": "^8", + "write": "^0.2.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/jonschlinkert/micromatch", + "keywords": [ + "bash", + "expand", + "expansion", + "expression", + "file", + "files", + "filter", + "find", + "glob", + "globbing", + "globs", + "globstar", + "match", + "matcher", + "matches", + "matching", + "minimatch", + "multimatch", + "path", + "pattern", + "patterns", + "regex", + "regexp", + "regular", + "shell", + "wildcard" + ], + "license": "MIT", + "main": "index.js", + "name": "micromatch", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/micromatch.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "braces", + "expand-brackets", + "expand-range", + "extglob", + "fill-range", + "gulp-micromatch", + "is-glob", + "parse-glob" + ] + }, + "reflinks": [ + "braces", + "expand-brackets", + "extglob", + "minimatch", + "multimatch", + "verb" + ], + "toc": false, + "layout": false, + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "2.3.11" +} diff --git a/node_modules/minimatch/LICENSE b/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/minimatch/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/minimatch/README.md b/node_modules/minimatch/README.md new file mode 100644 index 00000000..ad72b813 --- /dev/null +++ b/node_modules/minimatch/README.md @@ -0,0 +1,209 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.svg)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..5b5f8cf4 --- /dev/null +++ b/node_modules/minimatch/minimatch.js @@ -0,0 +1,923 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long') + } + + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/node_modules/minimatch/package.json b/node_modules/minimatch/package.json new file mode 100644 index 00000000..837dce46 --- /dev/null +++ b/node_modules/minimatch/package.json @@ -0,0 +1,63 @@ +{ + "_from": "minimatch@^3.0.4", + "_id": "minimatch@3.0.4", + "_inBundle": false, + "_integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "_location": "/minimatch", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "minimatch@^3.0.4", + "name": "minimatch", + "escapedName": "minimatch", + "rawSpec": "^3.0.4", + "saveSpec": null, + "fetchSpec": "^3.0.4" + }, + "_requiredBy": [ + "/glob" + ], + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "_shasum": "5166e286457f03306064be5497e8dbb0c3d32083", + "_spec": "minimatch@^3.0.4", + "_where": "/home/remi/github/CPP_BIDS/node_modules/glob", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "bundleDependencies": false, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "deprecated": false, + "description": "a glob matcher in javascript", + "devDependencies": { + "tap": "^10.3.2" + }, + "engines": { + "node": "*" + }, + "files": [ + "minimatch.js" + ], + "homepage": "https://github.com/isaacs/minimatch#readme", + "license": "ISC", + "main": "minimatch.js", + "name": "minimatch", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "scripts": { + "postpublish": "git push origin --all; git push origin --tags", + "postversion": "npm publish", + "preversion": "npm test", + "test": "tap test/*.js --cov" + }, + "version": "3.0.4" +} diff --git a/node_modules/minimist/.travis.yml b/node_modules/minimist/.travis.yml new file mode 100644 index 00000000..74c57bf1 --- /dev/null +++ b/node_modules/minimist/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.12" + - "iojs" +before_install: + - npm install -g npm@~1.4.6 diff --git a/node_modules/minimist/LICENSE b/node_modules/minimist/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/minimist/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/minimist/example/parse.js b/node_modules/minimist/example/parse.js new file mode 100644 index 00000000..f7c8d498 --- /dev/null +++ b/node_modules/minimist/example/parse.js @@ -0,0 +1,2 @@ +var argv = require('../')(process.argv.slice(2)); +console.log(argv); diff --git a/node_modules/minimist/index.js b/node_modules/minimist/index.js new file mode 100644 index 00000000..d2afe5e4 --- /dev/null +++ b/node_modules/minimist/index.js @@ -0,0 +1,245 @@ +module.exports = function (args, opts) { + if (!opts) opts = {}; + + var flags = { bools : {}, strings : {}, unknownFn: null }; + + if (typeof opts['unknown'] === 'function') { + flags.unknownFn = opts['unknown']; + } + + if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { + flags.allBools = true; + } else { + [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + flags.strings[aliases[key]] = true; + } + }); + + var defaults = opts['default'] || {}; + + var argv = { _ : [] }; + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--')+1); + args = args.slice(0, args.indexOf('--')); + } + + function argDefined(key, arg) { + return (flags.allBools && /^--[^=]+$/.test(arg)) || + flags.strings[key] || flags.bools[key] || aliases[key]; + } + + function setArg (key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) return; + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) : val + ; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + function setKey (obj, keys, value) { + var o = obj; + for (var i = 0; i < keys.length-1; i++) { + var key = keys[i]; + if (key === '__proto__') return; + if (o[key] === undefined) o[key] = {}; + if (o[key] === Object.prototype || o[key] === Number.prototype + || o[key] === String.prototype) o[key] = {}; + if (o[key] === Array.prototype) o[key] = []; + o = o[key]; + } + + var key = keys[keys.length - 1]; + if (key === '__proto__') return; + if (o === Object.prototype || o === Number.prototype + || o === String.prototype) o = {}; + if (o === Array.prototype) o = []; + if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { + o[key] = value; + } + else if (Array.isArray(o[key])) { + o[key].push(value); + } + else { + o[key] = [ o[key], value ]; + } + } + + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + if (/^--.+=/.test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + var key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } + else if (/^--no-.+/.test(arg)) { + var key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } + else if (/^--.+/.test(arg)) { + var key = arg.match(/^--(.+)/)[1]; + var next = args[i + 1]; + if (next !== undefined && !/^-/.test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, next, arg); + i++; + } + else if (/^(true|false)$/.test(next)) { + setArg(key, next === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + else if (/^-[^-]+/.test(arg)) { + var letters = arg.slice(1,-1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + var next = arg.slice(j+2); + + if (next === '-') { + setArg(letters[j], next, arg) + continue; + } + + if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { + setArg(letters[j], next.split('=')[1], arg); + broken = true; + break; + } + + if (/[A-Za-z]/.test(letters[j]) + && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j+1] && letters[j+1].match(/\W/)) { + setArg(letters[j], arg.slice(j+2), arg); + broken = true; + break; + } + else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + var key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) + && !flags.bools[key] + && (aliases[key] ? !aliasIsBoolean(key) : true)) { + setArg(key, args[i+1], arg); + i++; + } + else if (args[i+1] && /^(true|false)$/.test(args[i+1])) { + setArg(key, args[i+1] === 'true', arg); + i++; + } + else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } + else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push( + flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) + ); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (key) { + if (!hasKey(argv, key.split('.'))) { + setKey(argv, key.split('.'), defaults[key]); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[key]); + }); + } + }); + + if (opts['--']) { + argv['--'] = new Array(); + notFlags.forEach(function(key) { + argv['--'].push(key); + }); + } + else { + notFlags.forEach(function(key) { + argv._.push(key); + }); + } + + return argv; +}; + +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 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); +} + diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json new file mode 100644 index 00000000..d2262a99 --- /dev/null +++ b/node_modules/minimist/package.json @@ -0,0 +1,74 @@ +{ + "_from": "minimist@^1.2.0", + "_id": "minimist@1.2.5", + "_inBundle": false, + "_integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "_location": "/minimist", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "minimist@^1.2.0", + "name": "minimist", + "escapedName": "minimist", + "rawSpec": "^1.2.0", + "saveSpec": null, + "fetchSpec": "^1.2.0" + }, + "_requiredBy": [ + "/rc", + "/unified-args" + ], + "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "_shasum": "67d66014b66a6a8aaa0c083c5fd58df4e4e97602", + "_spec": "minimist@^1.2.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-args", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/minimist/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "parse argument options", + "devDependencies": { + "covert": "^1.0.0", + "tap": "~0.4.0", + "tape": "^3.5.0" + }, + "homepage": "https://github.com/substack/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "license": "MIT", + "main": "index.js", + "name": "minimist", + "repository": { + "type": "git", + "url": "git://github.com/substack/minimist.git" + }, + "scripts": { + "coverage": "covert test/*.js", + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "version": "1.2.5" +} diff --git a/node_modules/minimist/readme.markdown b/node_modules/minimist/readme.markdown new file mode 100644 index 00000000..5fd97ab1 --- /dev/null +++ b/node_modules/minimist/readme.markdown @@ -0,0 +1,95 @@ +# minimist + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.log(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ _: [ 'foo', 'bar', 'baz' ], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' } +``` + +# security + +Previous versions had a prototype pollution bug that could cause privilege +escalation in some circumstances when handling untrusted user input. + +Please use version 1.2.3 or later: https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: + + ``` + > require('./')('one two three -- four five --six'.split(' '), { '--': true }) + { _: [ 'one', 'two', 'three' ], + '--': [ 'four', 'five', '--six' ] } + ``` + + Note that with `opts['--']` set, parsing for arguments still stops after the + `--`. + +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT diff --git a/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js new file mode 100644 index 00000000..ac835483 --- /dev/null +++ b/node_modules/minimist/test/all_bool.js @@ -0,0 +1,32 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean true (default all --args to boolean)', function (t) { + var argv = parse(['moo', '--honk', 'cow'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); + +test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { + var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { + boolean: true + }); + + t.deepEqual(argv, { + honk: true, + tacos: 'good', + p: 55, + _: ['moo', 'cow'] + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); diff --git a/node_modules/minimist/test/bool.js b/node_modules/minimist/test/bool.js new file mode 100644 index 00000000..5f7dbde1 --- /dev/null +++ b/node_modules/minimist/test/bool.js @@ -0,0 +1,178 @@ +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false } + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { + boolean: ['x','y','z'] + }); + + t.deepEqual(argv, { + x : true, + y : false, + z : true, + _ : [ 'one', 'two', 'three' ] + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + herp: { alias: 'h', boolean: true } + }; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' } + }); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var opts = { + alias: { 'h': 'herp' }, + boolean: 'herp' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias array with options hash', function (t) { + var aliased = [ '-h', 'derp' ]; + var regular = [ '--herp', 'derp' ]; + var alt = [ '--harp', 'derp' ]; + var opts = { + alias: { 'h': ['herp', 'harp'] }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var altPropertyArgv = parse(alt, opts); + var expected = { + harp: true, + herp: true, + h: true, + '_': [ 'derp' ] + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.same(altPropertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = [ '-h', 'true' ]; + var regular = [ '--herp', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h' + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + '_': [ ] + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function(t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool' + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); + +test('boolean --boool=true', function (t) { + var parsed = parse(['--boool=true'], { + default: { + boool: false + }, + boolean: ['boool'] + }); + + t.same(parsed.boool, true); + t.end(); +}); + +test('boolean --boool=false', function (t) { + var parsed = parse(['--boool=false'], { + default: { + boool: true + }, + boolean: ['boool'] + }); + + t.same(parsed.boool, false); + t.end(); +}); + +test('boolean using something similar to true', function (t) { + var opts = { boolean: 'h' }; + var result = parse(['-h', 'true.txt'], opts); + var expected = { + h: true, + '_': ['true.txt'] + }; + + t.same(result, expected); + t.end(); +}); \ No newline at end of file diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js new file mode 100644 index 00000000..5a4fa5be --- /dev/null +++ b/node_modules/minimist/test/dash.js @@ -0,0 +1,31 @@ +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(5); + t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); + t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); + t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); + t.deepEqual( + parse([ '-b', '-' ], { boolean: 'b' }), + { b: true, _: [ '-' ] } + ); + t.deepEqual( + parse([ '-s', '-' ], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(3); + t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); + t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); +}); + +test('move arguments after the -- into their own `--` array', function(t) { + t.plan(1); + t.deepEqual( + parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }), + { name: 'John', _: [ 'before' ], '--': [ 'after' ] }); +}); diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js new file mode 100644 index 00000000..780a3112 --- /dev/null +++ b/node_modules/minimist/test/default_bool.js @@ -0,0 +1,35 @@ +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true } + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false } + }); + t.equal(argv.somefalse, false); + t.end(); +}); + +test('boolean default to null', function (t) { + var argv = parse([], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, null); + var argv = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null } + }); + t.equal(argv.maybe, true); + t.end(); + +}) diff --git a/node_modules/minimist/test/dotted.js b/node_modules/minimist/test/dotted.js new file mode 100644 index 00000000..d8b3e856 --- /dev/null +++ b/node_modules/minimist/test/dotted.js @@ -0,0 +1,22 @@ +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', {default: {'a.b': 11}}); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/node_modules/minimist/test/kv_short.js b/node_modules/minimist/test/kv_short.js new file mode 100644 index 00000000..f813b305 --- /dev/null +++ b/node_modules/minimist/test/kv_short.js @@ -0,0 +1,16 @@ +var parse = require('../'); +var test = require('tape'); + +test('short -k=v' , function (t) { + t.plan(1); + + var argv = parse([ '-b=123' ]); + t.deepEqual(argv, { b: 123, _: [] }); +}); + +test('multi short -k=v' , function (t) { + t.plan(1); + + var argv = parse([ '-a=whatever', '-b=robots' ]); + t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); +}); diff --git a/node_modules/minimist/test/long.js b/node_modules/minimist/test/long.js new file mode 100644 index 00000000..5d3a1e09 --- /dev/null +++ b/node_modules/minimist/test/long.js @@ -0,0 +1,31 @@ +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse([ '--bool' ]), + { bool : true, _ : [] }, + 'long boolean' + ); + t.deepEqual( + parse([ '--pow', 'xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture sp' + ); + t.deepEqual( + parse([ '--pow=xixxle' ]), + { pow : 'xixxle', _ : [] }, + 'long capture eq' + ); + t.deepEqual( + parse([ '--host', 'localhost', '--port', '555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures sp' + ); + t.deepEqual( + parse([ '--host=localhost', '--port=555' ]), + { host : 'localhost', port : 555, _ : [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/node_modules/minimist/test/num.js b/node_modules/minimist/test/num.js new file mode 100644 index 00000000..2cc77f4d --- /dev/null +++ b/node_modules/minimist/test/num.js @@ -0,0 +1,36 @@ +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789' + ]); + t.deepEqual(argv, { + x : 1234, + y : 5.67, + z : 1e7, + w : '10f', + hex : 0xdeadbeef, + _ : [ 789 ] + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse([ '-x', 1234, 789 ]); + t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/node_modules/minimist/test/parse.js b/node_modules/minimist/test/parse.js new file mode 100644 index 00000000..7b4a2a17 --- /dev/null +++ b/node_modules/minimist/test/parse.js @@ -0,0 +1,197 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse([ '--no-moo' ]), + { moo : false, _ : [] }, + 'no' + ); + t.deepEqual( + parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), + { v : ['a','b','c'], _ : [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek' + ]), + { + c : true, + a : true, + t : true, + s : 'woo', + h : 'awesome', + b : true, + bool : true, + key : 'value', + multi : [ 'quux', 'baz' ], + meep : false, + name : 'meowmers', + _ : [ 'bare', '--not-a-flag', 'eek' ] + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse([ '-t', 'moo' ], { boolean: 't' }); + t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: [ 't', 'verbose' ], + default: { verbose: true } + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'] + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params' , function (t) { + var args = parse([ '-s', "X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse([ "--s=X\nX" ]) + t.deepEqual(args, { _ : [], s : "X\nX" }); + t.end(); +}); + +test('strings' , function (t) { + var s = parse([ '-s', '0001234' ], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse([ '-x', '56' ], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([ ' ', ' ' ], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function(t) { + var s = parse([ '-s' ], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse([ '--str' ], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse([ '-art' ], { + string: [ 'a', 't' ] + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + + +test('string and alias', function(t) { + var x = parse([ '--str', '000123' ], { + string: 's', + alias: { s: 'str' } + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse([ '-s', '000123' ], { + string: 'str', + alias: { str: 's' } + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse([ '-I/foo/bar/baz' ]), + { I : '/foo/bar/baz', _ : [] } + ); + t.same( + parse([ '-xyz/foo/bar/baz' ]), + { x : true, y : true, z : '/foo/bar/baz', _ : [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: 'zoom' } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse([ '-f', '11', '--zoom', '55' ], { + alias: { z: [ 'zm', 'zoom' ] } + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop' + ]); + + t.same(argv.foo, { + bar : 3, + baz : 4, + quux : { + quibble : 5, + o_O : true + } + }); + t.same(argv.beep, { boop : true }); + t.end(); +}); diff --git a/node_modules/minimist/test/parse_modified.js b/node_modules/minimist/test/parse_modified.js new file mode 100644 index 00000000..ab620dc5 --- /dev/null +++ b/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,9 @@ +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions' , function (t) { + t.plan(1); + + var argv = parse([ '-b', '123' ], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: [123] }); +}); diff --git a/node_modules/minimist/test/proto.js b/node_modules/minimist/test/proto.js new file mode 100644 index 00000000..8649107e --- /dev/null +++ b/node_modules/minimist/test/proto.js @@ -0,0 +1,44 @@ +var parse = require('../'); +var test = require('tape'); + +test('proto pollution', function (t) { + var argv = parse(['--__proto__.x','123']); + t.equal({}.x, undefined); + t.equal(argv.__proto__.x, undefined); + t.equal(argv.x, undefined); + t.end(); +}); + +test('proto pollution (array)', function (t) { + var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']); + t.equal({}.z, undefined); + t.deepEqual(argv.x, [4,5]); + t.equal(argv.x.z, undefined); + t.equal(argv.x.__proto__.z, undefined); + t.end(); +}); + +test('proto pollution (number)', function (t) { + var argv = parse(['--x','5','--x.__proto__.z','100']); + t.equal({}.z, undefined); + t.equal((4).z, undefined); + t.equal(argv.x, 5); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (string)', function (t) { + var argv = parse(['--x','abc','--x.__proto__.z','def']); + t.equal({}.z, undefined); + t.equal('...'.z, undefined); + t.equal(argv.x, 'abc'); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (constructor)', function (t) { + var argv = parse(['--constructor.prototype.y','123']); + t.equal({}.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); diff --git a/node_modules/minimist/test/short.js b/node_modules/minimist/test/short.js new file mode 100644 index 00000000..d513a1c2 --- /dev/null +++ b/node_modules/minimist/test/short.js @@ -0,0 +1,67 @@ +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); + t.deepEqual( + parse([ '-123', '456' ]), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse([ '-b' ]), + { b : true, _ : [] }, + 'short boolean' + ); + t.deepEqual( + parse([ 'foo', 'bar', 'baz' ]), + { _ : [ 'foo', 'bar', 'baz' ] }, + 'bare' + ); + t.deepEqual( + parse([ '-cats' ]), + { c : true, a : true, t : true, s : true, _ : [] }, + 'group' + ); + t.deepEqual( + parse([ '-cats', 'meow' ]), + { c : true, a : true, t : true, s : 'meow', _ : [] }, + 'short group next' + ); + t.deepEqual( + parse([ '-h', 'localhost' ]), + { h : 'localhost', _ : [] }, + 'short capture' + ); + t.deepEqual( + parse([ '-h', 'localhost', '-p', '555' ]), + { h : 'localhost', p : 555, _ : [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), + { + f : true, p : 555, h : 'localhost', + _ : [ 'script.js' ] + } + ); + t.end(); +}); diff --git a/node_modules/minimist/test/stop_early.js b/node_modules/minimist/test/stop_early.js new file mode 100644 index 00000000..bdf9fbcb --- /dev/null +++ b/node_modules/minimist/test/stop_early.js @@ -0,0 +1,15 @@ +var parse = require('../'); +var test = require('tape'); + +test('stops parsing on the first non-option when stopEarly is set', function (t) { + var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { + stopEarly: true + }); + + t.deepEqual(argv, { + aaa: 'bbb', + _: ['ccc', '--ddd'] + }); + + t.end(); +}); diff --git a/node_modules/minimist/test/unknown.js b/node_modules/minimist/test/unknown.js new file mode 100644 index 00000000..462a36bd --- /dev/null +++ b/node_modules/minimist/test/unknown.js @@ -0,0 +1,102 @@ +var parse = require('../'); +var test = require('tape'); + +test('boolean and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'true', '--derp', 'true' ]; + var regular = [ '--herp', 'true', '-d', 'true' ]; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('flag boolean true any double hyphen argument is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { + boolean: true, + unknown: unknownFn + }); + t.same(unknown, ['--tacos=good', 'cow', '-p']); + t.same(argv, { + honk: true, + _: [] + }); + t.end(); +}); + +test('string and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello', '--derp', 'goodbye' ]; + var regular = [ '--herp', 'hello', '-d', 'moon' ]; + var opts = { + alias: { h: 'herp' }, + string: 'h', + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('default and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '-h', 'hello' ]; + var regular = [ '--herp', 'hello' ]; + var opts = { + default: { 'h': 'bar' }, + alias: { 'h': 'herp' }, + unknown: unknownFn + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + + t.same(unknown, []); + t.end(); + unknownFn(); // exercise fn for 100% coverage +}); + +test('value following -- is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = [ '--bad', '--', 'good', 'arg' ]; + var opts = { + '--': true, + unknown: unknownFn + }; + var argv = parse(aliased, opts); + + t.same(unknown, ['--bad']); + t.same(argv, { + '--': ['good', 'arg'], + '_': [] + }) + t.end(); +}); diff --git a/node_modules/minimist/test/whitespace.js b/node_modules/minimist/test/whitespace.js new file mode 100644 index 00000000..8a52a58c --- /dev/null +++ b/node_modules/minimist/test/whitespace.js @@ -0,0 +1,8 @@ +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace' , function (t) { + t.plan(1); + var x = parse([ '-x', '\t' ]).x; + t.equal(x, '\t'); +}); diff --git a/node_modules/mixin-deep/LICENSE b/node_modules/mixin-deep/LICENSE new file mode 100644 index 00000000..99c93691 --- /dev/null +++ b/node_modules/mixin-deep/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-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/mixin-deep/README.md b/node_modules/mixin-deep/README.md new file mode 100644 index 00000000..111bde00 --- /dev/null +++ b/node_modules/mixin-deep/README.md @@ -0,0 +1,80 @@ +# mixin-deep [![NPM version](https://img.shields.io/npm/v/mixin-deep.svg?style=flat)](https://www.npmjs.com/package/mixin-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/mixin-deep.svg?style=flat)](https://npmjs.org/package/mixin-deep) [![NPM total downloads](https://img.shields.io/npm/dt/mixin-deep.svg?style=flat)](https://npmjs.org/package/mixin-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/mixin-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/mixin-deep) + +> Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. + +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 mixin-deep +``` + +## Usage + +```js +var mixinDeep = require('mixin-deep'); + +mixinDeep({a: {aa: 'aa'}}, {a: {bb: 'bb'}}, {a: {cc: 'cc'}}); +//=> { a: { aa: 'aa', bb: 'bb', cc: 'cc' } } +``` + +## 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: + +* [defaults-deep](https://www.npmjs.com/package/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object. | [homepage](https://github.com/jonschlinkert/defaults-deep "Like `extend` but recursively copies only the missing properties/values to the target 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-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://github.com/jonschlinkert/mixin-object) | [homepage](https://github.com/jonschlinkert/mixin-object "Mixin the own and inherited properties of other objects onto the first object. Pass an empty object as the first arg to shallow clone.") + +### 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 09, 2017._ \ No newline at end of file diff --git a/node_modules/mixin-deep/index.js b/node_modules/mixin-deep/index.js new file mode 100644 index 00000000..47face2a --- /dev/null +++ b/node_modules/mixin-deep/index.js @@ -0,0 +1,64 @@ +'use strict'; + +var isExtendable = require('is-extendable'); +var forIn = require('for-in'); + +function mixinDeep(target, objects) { + var len = arguments.length, i = 0; + while (++i < len) { + var obj = arguments[i]; + if (isObject(obj)) { + forIn(obj, copy, target); + } + } + return target; +} + +/** + * Copy properties from the source object to the + * target object. + * + * @param {*} `val` + * @param {String} `key` + */ + +function copy(val, key) { + if (!isValidKey(key)) { + return; + } + + var obj = this[key]; + if (isObject(val) && isObject(obj)) { + mixinDeep(obj, val); + } else { + this[key] = val; + } +} + +/** + * Returns true if `val` is an object or function. + * + * @param {any} val + * @return {Boolean} + */ + +function isObject(val) { + return isExtendable(val) && !Array.isArray(val); +} + +/** + * Returns true if `key` is a valid key to use when extending objects. + * + * @param {String} `key` + * @return {Boolean} + */ + +function isValidKey(key) { + return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; +}; + +/** + * Expose `mixinDeep` + */ + +module.exports = mixinDeep; diff --git a/node_modules/mixin-deep/node_modules/is-extendable/LICENSE b/node_modules/mixin-deep/node_modules/is-extendable/LICENSE new file mode 100644 index 00000000..c0d7f136 --- /dev/null +++ b/node_modules/mixin-deep/node_modules/is-extendable/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/mixin-deep/node_modules/is-extendable/README.md b/node_modules/mixin-deep/node_modules/is-extendable/README.md new file mode 100644 index 00000000..875b56a7 --- /dev/null +++ b/node_modules/mixin-deep/node_modules/is-extendable/README.md @@ -0,0 +1,88 @@ +# is-extendable [![NPM version](https://img.shields.io/npm/v/is-extendable.svg?style=flat)](https://www.npmjs.com/package/is-extendable) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-extendable.svg?style=flat)](https://npmjs.org/package/is-extendable) [![NPM total downloads](https://img.shields.io/npm/dt/is-extendable.svg?style=flat)](https://npmjs.org/package/is-extendable) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-extendable.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-extendable) + +> Returns true if a value is a plain object, array or function. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-extendable +``` + +## Usage + +```js +var isExtendable = require('is-extendable'); +``` + +Returns true if the value is any of the following: + +* array +* plain object +* function + +## Notes + +All objects in JavaScript can have keys, but it's a pain to check for this, since we ether need to verify that the value is not `null` or `undefined` and: + +* the value is not a primitive, or +* that the object is a plain object, function or array + +Also note that an `extendable` object is not the same as an [extensible object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible), which is one that (in es6) is not sealed, frozen, or marked as non-extensible using `preventExtensions`. + +## Release history + +### v1.0.0 - 2017/07/20 + +**Breaking changes** + +* No longer considers date, regex or error objects to be extendable + +## 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.") +* [is-equal-shallow](https://www.npmjs.com/package/is-equal-shallow): Does a shallow comparison of two objects, returning false if the keys or values differ. | [homepage](https://github.com/jonschlinkert/is-equal-shallow "Does a shallow comparison of two objects, returning false if the keys or values differ.") +* [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 "Returns true if an object was created by the `Object` constructor.") +* [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.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") + +### 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 July 20, 2017._ \ No newline at end of file diff --git a/node_modules/mixin-deep/node_modules/is-extendable/index.d.ts b/node_modules/mixin-deep/node_modules/is-extendable/index.d.ts new file mode 100644 index 00000000..b96d5075 --- /dev/null +++ b/node_modules/mixin-deep/node_modules/is-extendable/index.d.ts @@ -0,0 +1,5 @@ +export = isExtendable; + +declare function isExtendable(val: any): boolean; + +declare namespace isExtendable {} diff --git a/node_modules/mixin-deep/node_modules/is-extendable/index.js b/node_modules/mixin-deep/node_modules/is-extendable/index.js new file mode 100644 index 00000000..a8b26ad0 --- /dev/null +++ b/node_modules/mixin-deep/node_modules/is-extendable/index.js @@ -0,0 +1,14 @@ +/*! + * is-extendable + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var isPlainObject = require('is-plain-object'); + +module.exports = function isExtendable(val) { + return isPlainObject(val) || typeof val === 'function' || Array.isArray(val); +}; diff --git a/node_modules/mixin-deep/node_modules/is-extendable/package.json b/node_modules/mixin-deep/node_modules/is-extendable/package.json new file mode 100644 index 00000000..d20ae476 --- /dev/null +++ b/node_modules/mixin-deep/node_modules/is-extendable/package.json @@ -0,0 +1,98 @@ +{ + "_from": "is-extendable@^1.0.1", + "_id": "is-extendable@1.0.1", + "_inBundle": false, + "_integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "_location": "/mixin-deep/is-extendable", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-extendable@^1.0.1", + "name": "is-extendable", + "escapedName": "is-extendable", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/mixin-deep" + ], + "_resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "_shasum": "a7470f9e426733d81bd81e1155264e3a3507cab4", + "_spec": "is-extendable@^1.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/mixin-deep", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-extendable/issues" + }, + "bundleDependencies": false, + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "deprecated": false, + "description": "Returns true if a value is a plain object, array or function.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.4.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/jonschlinkert/is-extendable", + "keywords": [ + "array", + "assign", + "check", + "date", + "extend", + "extendable", + "extensible", + "function", + "is", + "object", + "regex", + "test" + ], + "license": "MIT", + "main": "index.js", + "name": "is-extendable", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-extendable.git" + }, + "scripts": { + "test": "mocha" + }, + "types": "index.d.ts", + "verb": { + "related": { + "list": [ + "assign-deep", + "is-equal-shallow", + "is-plain-object", + "isobject", + "kind-of" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.0.1" +} diff --git a/node_modules/mixin-deep/package.json b/node_modules/mixin-deep/package.json new file mode 100644 index 00000000..c2e19871 --- /dev/null +++ b/node_modules/mixin-deep/package.json @@ -0,0 +1,98 @@ +{ + "_from": "mixin-deep@^1.2.0", + "_id": "mixin-deep@1.3.2", + "_inBundle": false, + "_integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "_location": "/mixin-deep", + "_phantomChildren": { + "is-plain-object": "2.0.4" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "mixin-deep@^1.2.0", + "name": "mixin-deep", + "escapedName": "mixin-deep", + "rawSpec": "^1.2.0", + "saveSpec": null, + "fetchSpec": "^1.2.0" + }, + "_requiredBy": [ + "/base" + ], + "_resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "_shasum": "1120b43dc359a785dce65b55b82e257ccf479566", + "_spec": "mixin-deep@^1.2.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/base", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/mixin-deep/issues" + }, + "bundleDependencies": false, + "dependencies": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "deprecated": false, + "description": "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3", + "should": "^13.1.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/mixin-deep", + "keywords": [ + "deep", + "extend", + "key", + "keys", + "merge", + "mixin", + "object", + "prop", + "properties", + "util", + "values" + ], + "license": "MIT", + "main": "index.js", + "name": "mixin-deep", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/mixin-deep.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "defaults-deep", + "extend-shallow", + "merge-deep", + "mixin-object" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "1.3.2" +} diff --git a/node_modules/ms/index.js b/node_modules/ms/index.js new file mode 100644 index 00000000..6a522b16 --- /dev/null +++ b/node_modules/ms/index.js @@ -0,0 +1,152 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd'; + } + if (ms >= h) { + return Math.round(ms / h) + 'h'; + } + if (ms >= m) { + return Math.round(ms / m) + 'm'; + } + if (ms >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/ms/license.md b/node_modules/ms/license.md new file mode 100644 index 00000000..69b61253 --- /dev/null +++ b/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +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/ms/package.json b/node_modules/ms/package.json new file mode 100644 index 00000000..2ea0f3a1 --- /dev/null +++ b/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@2.0.0", + "_id": "ms@2.0.0", + "_inBundle": false, + "_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "_location": "/ms", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "ms@2.0.0", + "name": "ms", + "escapedName": "ms", + "rawSpec": "2.0.0", + "saveSpec": null, + "fetchSpec": "2.0.0" + }, + "_requiredBy": [ + "/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8", + "_spec": "ms@2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny milisecond conversion utility", + "devDependencies": { + "eslint": "3.19.0", + "expect.js": "0.3.1", + "husky": "0.13.3", + "lint-staged": "3.4.1", + "mocha": "3.4.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.0.0" +} diff --git a/node_modules/ms/readme.md b/node_modules/ms/readme.md new file mode 100644 index 00000000..84a9974c --- /dev/null +++ b/node_modules/ms/readme.md @@ -0,0 +1,51 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +``` + +### Convert from milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +### Time format written-out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [node](https://nodejs.org) and in the browser. +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of equivalent ms is returned. + +## Caught a bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/nan/CHANGELOG.md b/node_modules/nan/CHANGELOG.md new file mode 100644 index 00000000..44858c70 --- /dev/null +++ b/node_modules/nan/CHANGELOG.md @@ -0,0 +1,533 @@ +# NAN ChangeLog + +**Version 2.14.1: current Node 14.0.0, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1** + +### 2.14.1 Apr 21 2020 + + - Bugfix: use GetBackingStore() instead of GetContents() (#888) 2c023bd447661a61071da318b0ff4003c3858d39 + +### 2.14.0 May 16 2019 + + - Feature: Add missing methods to Nan::Maybe (#852) 4e962489fb84a184035b9fa74f245f650249aca6 + +### 2.13.2 Mar 24 2019 + + - Bugfix: remove usage of deprecated `IsNearDeath` (#842) fbaf42252af279c3d867c6b193571f9711c39847 + +### 2.13.1 Mar 14 2019 + + - Bugfix: check V8 version directly instead of inferring from NMV (#840) 12f9df9f393285de8fb4a8cd01478dc4fe3b089d + +### 2.13.0 Mar 13 2019 + + - Feature: add support for node master (#831) 113c0282072e7ff4f9dfc98b432fd894b798c2c + +### 2.12.1 Dec 18 2018 + + - Bugfix: Fix build breakage with Node.js 10.0.0-10.9.0. (#833) 625e90e8fef8d39ffa7247250a76a100b2487474 + +### 2.12.0 Dec 16 2018 + + - Bugfix: Add scope.Escape() to Call() (#817) 2e5ed4fc3a8ac80a6ef1f2a55099ab3ac8800dc6 + - Bugfix: Fix Node.js v10.12.0 deprecation warnings. 509859cc23b1770376b56550a027840a2ce0f73d + - Feature: Allow SetWeak() for non-object persistent handles. (#824) e6ef6a48e7e671fe3e4b7dddaa8912a3f8262ecd + +### 2.11.1 Sep 29 2018 + + - Fix: adapt to V8 7.0 24a22c3b25eeeec2016c6ec239bdd6169e985447 + +### 2.11.0 Aug 25 2018 + + - Removal: remove `FunctionCallbackInfo::Callee` for nodejs `>= 10` 1a56c0a6efd4fac944cb46c30912a8e023bda7d4 + - Bugfix: Fix `AsyncProgressWorkerBase::WorkProgress` sends invalid data b0c764d1dab11e9f8b37ffb81e2560a4498aad5e + - Feature: Introduce `GetCurrentEventLoop` b4911b0bb1f6d47d860e10ec014d941c51efac5e + - Feature: Add `NAN_MODULE_WORKER_ENABLED` macro as a replacement for `NAN_MODULE` b058fb047d18a58250e66ae831444441c1f2ac7a + +### 2.10.0 Mar 16 2018 + + - Deprecation: Deprecate `MakeCallback` 5e92b19a59e194241d6a658bd6ff7bfbda372950 + - Feature: add `Nan::Call` overload 4482e1242fe124d166fc1a5b2be3c1cc849fe452 + - Feature: add more `Nan::Call` overloads 8584e63e6d04c7d2eb8c4a664e4ef57d70bf672b + - Feature: Fix deprecation warnings for Node 10 1caf258243b0602ed56922bde74f1c91b0cbcb6a + +### 2.9.2 Feb 22 2018 + + - Bugfix: Bandaid for async hooks 212bd2f849be14ef1b02fc85010b053daa24252b + +### 2.9.1 Feb 22 2018 + + - Bugfix: Avoid deprecation warnings in deprecated `Nan::Callback::operator()` 372b14d91289df4604b0f81780709708c45a9aa4 + - Bugfix: Avoid deprecation warnings in `Nan::JSON` 3bc294bce0b7d0a3ee4559926303e5ed4866fda2 + +### 2.9.0 Feb 22 2018 + + - Deprecation: Deprecate legacy `Callback::Call` 6dd5fa690af61ca3523004b433304c581b3ea309 + - Feature: introduce `AsyncResource` class 90c0a179c0d8cb5fd26f1a7d2b1d6231eb402d48o + - Feature: Add context aware `Nan::Callback::Call` functions 7169e09fb088418b6e388222e88b4c13f07ebaee + - Feature: Make `AsyncWorker` context aware 066ba21a6fb9e2b5230c9ed3a6fc51f1211736a4 + - Feature: add `Callback` overload to `Nan::Call` 5328daf66e202658c1dc0d916c3aaba99b3cc606 + - Bugfix: fix warning: suggest parentheses around `&&` within `||` b2bb63d68b8ae623a526b542764e1ac82319cb2c + - Bugfix: Fix compilation on io.js 3 d06114dba0a522fb436f0c5f47b994210968cd7b + +### 2.8.0 Nov 15 2017 + + - Deprecation: Deprecate `Nan::ForceSet` in favor of `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 + - Feature: Add `Nan::AsyncProgressQueueWorker` a976636ecc2ef617d1b061ce4a6edf39923691cb + - Feature: Add `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 + - Bugfix: Fix compiling on io.js 1 & 2 82705a64503ce60c62e98df5bd02972bba090900 + - Bugfix: Use DefineOwnProperty instead of ForceSet 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 + +### 2.7.0 Aug 30 2017 + + - Feature: Add `Nan::To()` overload. b93280670c9f6da42ed4cf6cbf085ffdd87bd65b + - Bugfix: Fix ternary in `Nan::MaybeLocal::FromMaybe()`. 79a26f7d362e756a9524e672a82c3d603b542867 + +### 2.6.2 Apr 12 2017 + + - Bugfix: Fix v8::JSON::Parse() deprecation warning. 87f6a3c65815fa062296a994cc863e2fa124867d + +### 2.6.1 Apr 6 2017 + + - Bugfix: nan_json.h: fix build breakage in Node 6 ac8d47dc3c10bfbf3f15a6b951633120c0ee6d51 + +### 2.6.0 Apr 6 2017 + + - Feature: nan: add support for JSON::Parse & Stringify b533226c629cce70e1932a873bb6f849044a56c5 + +### 2.5.1 Jan 23 2017 + + - Bugfix: Fix disappearing handle for private value 6a80995694f162ef63dbc9948fbefd45d4485aa0 + - Bugfix: Add missing scopes a93b8bae6bc7d32a170db6e89228b7f60ee57112 + - Bugfix: Use string::data instead of string::front in NewOneByteString d5f920371e67e1f3b268295daee6e83af86b6e50 + +### 2.5.0 Dec 21 2016 + + - Feature: Support Private accessors a86255cb357e8ad8ccbf1f6a4a901c921e39a178 + - Bugfix: Abort in delete operators that shouldn't be called 0fe38215ff8581703967dfd26c12793feb960018 + +### 2.4.0 Jul 10 2016 + + - Feature: Rewrite Callback to add Callback::Reset c4cf44d61f8275cd5f7b0c911d7a806d4004f649 + - Feature: AsyncProgressWorker: add template types for .send 1242c9a11a7ed481c8f08ec06316385cacc513d0 + - Bugfix: Add constness to old Persistent comparison operators bd43cb9982c7639605d60fd073efe8cae165d9b2 + +### 2.3.5 May 31 2016 + + - Bugfix: Replace NAN_INLINE with 'inline' keyword. 71819d8725f822990f439479c9aba3b240804909 + +### 2.3.4 May 31 2016 + + - Bugfix: Remove V8 deprecation warnings 0592fb0a47f3a1c7763087ebea8e1138829f24f9 + - Bugfix: Fix new versions not to use WeakCallbackInfo::IsFirstPass 615c19d9e03d4be2049c10db0151edbc3b229246 + - Bugfix: Make ObjectWrap::handle() const d19af99595587fe7a26bd850af6595c2a7145afc + - Bugfix: Fix compilation errors related to 0592fb0a47f3a1c7763087ebea8e1138829f24f9 e9191c525b94f652718325e28610a1adcf90fed8 + +### 2.3.3 May 4 2016 + + - Bugfix: Refactor SetMethod() to deal with v8::Templates (#566) b9083cf6d5de6ebe6bcb49c7502fbb7c0d9ddda8 + +### 2.3.2 Apr 27 2016 + + - Bugfix: Fix compilation on outdated versions due to Handle removal f8b7c875d04d425a41dfd4f3f8345bc3a11e6c52 + +### 2.3.1 Apr 27 2016 + + - Bugfix: Don't use deprecated v8::Template::Set() in SetMethod a90951e9ea70fa1b3836af4b925322919159100e + +### 2.3.0 Apr 27 2016 + + - Feature: added Signal() for invoking async callbacks without sending data from AsyncProgressWorker d8adba45f20e077d00561b20199133620c990b38 + - Bugfix: Don't use deprecated v8::Template::Set() 00dacf0a4b86027415867fa7f1059acc499dcece + +### 2.2.1 Mar 29 2016 + + - Bugfix: Use NewFromUnsigned in ReturnValue::Set(uint32_t i) for pre_12 3a18f9bdce29826e0e4c217854bc476918241a58 + - Performance: Remove unneeeded nullptr checks b715ef44887931c94f0d1605b3b1a4156eebece9 + +### 2.2.0 Jan 9 2016 + + - Feature: Add Function::Call wrapper 4c157474dacf284d125c324177b45aa5dabc08c6 + - Feature: Rename GC*logueCallback to GCCallback for > 4.0 3603435109f981606d300eb88004ca101283acec + - Bugfix: Fix Global::Pass for old versions 367e82a60fbaa52716232cc89db1cc3f685d77d9 + - Bugfix: Remove weird MaybeLocal wrapping of what already is a MaybeLocal 23b4590db10c2ba66aee2338aebe9751c4cb190b + +### 2.1.0 Oct 8 2015 + + - Deprecation: Deprecate NanErrnoException in favor of ErrnoException 0af1ca4cf8b3f0f65ed31bc63a663ab3319da55c + - Feature: added helper class for accessing contents of typedarrays 17b51294c801e534479d5463697a73462d0ca555 + - Feature: [Maybe types] Add MakeMaybe(...) 48d7b53d9702b0c7a060e69ea10fea8fb48d814d + - Feature: new: allow utf16 string with length 66ac6e65c8ab9394ef588adfc59131b3b9d8347b + - Feature: Introduce SetCallHandler and SetCallAsFunctionHandler 7764a9a115d60ba10dc24d86feb0fbc9b4f75537 + - Bugfix: Enable creating Locals from Globals under Node 0.10. 9bf9b8b190821af889790fdc18ace57257e4f9ff + - Bugfix: Fix issue #462 where PropertyCallbackInfo data is not stored safely. 55f50adedd543098526c7b9f4fffd607d3f9861f + +### 2.0.9 Sep 8 2015 + + - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 + +### 2.0.8 Aug 28 2015 + + - Work around duplicate linking bug in clang 11902da + +### 2.0.7 Aug 26 2015 + + - Build: Repackage + +### 2.0.6 Aug 26 2015 + + - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 + - Bugfix: Remove unused static std::map instances 525bddc + - Bugfix: Make better use of maybe versions of APIs bfba85b + - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d + +### 2.0.5 Aug 10 2015 + + - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 + - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d + +### 2.0.4 Aug 6 2015 + + - Build: Repackage + +### 2.0.3 Aug 6 2015 + + - Bugfix: Don't use clang++ / g++ syntax extension. 231450e + +### 2.0.2 Aug 6 2015 + + - Build: Repackage + +### 2.0.1 Aug 6 2015 + + - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 + - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 + - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f + - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed + +### 2.0.0 Jul 31 2015 + + - Change: Renamed identifiers with leading underscores b5932b4 + - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 + - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 + - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 + - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 + - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d + - Change: Remove Nan prefix from all names 72d1f67 + - Change: Update Buffer API for new upstream changes d5d3291 + - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a + - Change: Get rid of Handles e6c0daf + - Feature: Support io.js 3 with V8 4.4 + - Feature: Introduce NanPersistent 7fed696 + - Feature: Introduce NanGlobal 4408da1 + - Feature: Added NanTryCatch 10f1ca4 + - Feature: Update for V8 v4.3 4b6404a + - Feature: Introduce NanNewOneByteString c543d32 + - Feature: Introduce namespace Nan 67ed1b1 + - Removal: Remove NanLocker and NanUnlocker dd6e401 + - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 + - Removal: Remove NanReturn* macros d90a25c + - Removal: Remove HasInstance e8f84fe + + +### 1.9.0 Jul 31 2015 + + - Feature: Added `NanFatalException` 81d4a2c + - Feature: Added more error types 4265f06 + - Feature: Added dereference and function call operators to NanCallback c4b2ed0 + - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c + - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 + - Feature: Added NanErrnoException dd87d9e + - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 + - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c + - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b + +### 1.8.4 Apr 26 2015 + + - Build: Repackage + +### 1.8.3 Apr 26 2015 + + - Bugfix: Include missing header 1af8648 + +### 1.8.2 Apr 23 2015 + + - Build: Repackage + +### 1.8.1 Apr 23 2015 + + - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 + +### 1.8.0 Apr 23 2015 + + - Feature: Allow primitives with NanReturnValue 2e4475e + - Feature: Added comparison operators to NanCallback 55b075e + - Feature: Backport thread local storage 15bb7fa + - Removal: Remove support for signatures with arguments 8a2069d + - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 + +### 1.7.0 Feb 28 2015 + + - Feature: Made NanCallback::Call accept optional target 8d54da7 + - Feature: Support atom-shell 0.21 0b7f1bb + +### 1.6.2 Feb 6 2015 + + - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 + +### 1.6.1 Jan 23 2015 + + - Build: version bump + +### 1.5.3 Jan 23 2015 + + - Build: repackage + +### 1.6.0 Jan 23 2015 + + - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af + - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 + - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 + +### 1.5.2 Jan 23 2015 + + - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 + - Bugfix: Readded missing String constructors 18d828f + - Bugfix: Add overload handling NanNew(..) 5ef813b + - Bugfix: Fix uv_work_cb versioning 997e4ae + - Bugfix: Add function factory and test 4eca89c + - Bugfix: Add object template factory and test cdcb951 + - Correctness: Lifted an io.js related typedef c9490be + - Correctness: Make explicit downcasts of String lengths 00074e6 + - Windows: Limit the scope of disabled warning C4530 83d7deb + +### 1.5.1 Jan 15 2015 + + - Build: version bump + +### 1.4.3 Jan 15 2015 + + - Build: version bump + +### 1.4.2 Jan 15 2015 + + - Feature: Support io.js 0dbc5e8 + +### 1.5.0 Jan 14 2015 + + - Feature: Support io.js b003843 + - Correctness: Improved NanNew internals 9cd4f6a + - Feature: Implement progress to NanAsyncWorker 8d6a160 + +### 1.4.1 Nov 8 2014 + + - Bugfix: Handle DEBUG definition correctly + - Bugfix: Accept int as Boolean + +### 1.4.0 Nov 1 2014 + + - Feature: Added NAN_GC_CALLBACK 6a5c245 + - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 + - Correctness: Added constness to references in NanHasInstance 02c61cd + - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 + - Windoze: Shut Visual Studio up when compiling 8d558c1 + - License: Switch to plain MIT from custom hacked MIT license 11de983 + - Build: Added test target to Makefile e232e46 + - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 + - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 + - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 + +### 1.3.0 Aug 2 2014 + + - Added NanNew(std::string) + - Added NanNew(std::string&) + - Added NanAsciiString helper class + - Added NanUtf8String helper class + - Added NanUcs2String helper class + - Deprecated NanRawString() + - Deprecated NanCString() + - Added NanGetIsolateData(v8::Isolate *isolate) + - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) + - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) + - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) + - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) + +### 1.2.0 Jun 5 2014 + + - Add NanSetPrototypeTemplate + - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, + introduced _NanWeakCallbackDispatcher + - Removed -Wno-unused-local-typedefs from test builds + - Made test builds Windows compatible ('Sleep()') + +### 1.1.2 May 28 2014 + + - Release to fix more stuff-ups in 1.1.1 + +### 1.1.1 May 28 2014 + + - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 + +### 1.1.0 May 25 2014 + + - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead + - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), + (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, + v8::String::ExternalAsciiStringResource* + - Deprecate NanSymbol() + - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker + +### 1.0.0 May 4 2014 + + - Heavy API changes for V8 3.25 / Node 0.11.13 + - Use cpplint.py + - Removed NanInitPersistent + - Removed NanPersistentToLocal + - Removed NanFromV8String + - Removed NanMakeWeak + - Removed NanNewLocal + - Removed NAN_WEAK_CALLBACK_OBJECT + - Removed NAN_WEAK_CALLBACK_DATA + - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions + - Introduce NanUndefined, NanNull, NanTrue and NanFalse + - Introduce NanEscapableScope and NanEscapeScope + - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) + - Introduce NanMakeCallback for node::MakeCallback + - Introduce NanSetTemplate + - Introduce NanGetCurrentContext + - Introduce NanCompileScript and NanRunScript + - Introduce NanAdjustExternalMemory + - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback + - Introduce NanGetHeapStatistics + - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() + +### 0.8.0 Jan 9 2014 + + - NanDispose -> NanDisposePersistent, deprecate NanDispose + - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() + +### 0.7.1 Jan 9 2014 + + - Fixes to work against debug builds of Node + - Safer NanPersistentToLocal (avoid reinterpret_cast) + - Speed up common NanRawString case by only extracting flattened string when necessary + +### 0.7.0 Dec 17 2013 + + - New no-arg form of NanCallback() constructor. + - NanCallback#Call takes Handle rather than Local + - Removed deprecated NanCallback#Run method, use NanCallback#Call instead + - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS + - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() + - Introduce NanRawString() for char* (or appropriate void*) from v8::String + (replacement for NanFromV8String) + - Introduce NanCString() for null-terminated char* from v8::String + +### 0.6.0 Nov 21 2013 + + - Introduce NanNewLocal(v8::Handle value) for use in place of + v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 + +### 0.5.2 Nov 16 2013 + + - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public + +### 0.5.1 Nov 12 2013 + + - Use node::MakeCallback() instead of direct v8::Function::Call() + +### 0.5.0 Nov 11 2013 + + - Added @TooTallNate as collaborator + - New, much simpler, "include_dirs" for binding.gyp + - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros + +### 0.4.4 Nov 2 2013 + + - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ + +### 0.4.3 Nov 2 2013 + + - Include node_object_wrap.h, removed from node.h for Node 0.11.8. + +### 0.4.2 Nov 2 2013 + + - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for + Node 0.11.8 release. + +### 0.4.1 Sep 16 2013 + + - Added explicit `#include ` as it was removed from node.h for v0.11.8 + +### 0.4.0 Sep 2 2013 + + - Added NAN_INLINE and NAN_DEPRECATED and made use of them + - Added NanError, NanTypeError and NanRangeError + - Cleaned up code + +### 0.3.2 Aug 30 2013 + + - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent + in NanAsyncWorker + +### 0.3.1 Aug 20 2013 + + - fix "not all control paths return a value" compile warning on some platforms + +### 0.3.0 Aug 19 2013 + + - Made NAN work with NPM + - Lots of fixes to NanFromV8String, pulling in features from new Node core + - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API + - Added optional error number argument for NanThrowError() + - Added NanInitPersistent() + - Added NanReturnNull() and NanReturnEmptyString() + - Added NanLocker and NanUnlocker + - Added missing scopes + - Made sure to clear disposed Persistent handles + - Changed NanAsyncWorker to allocate error messages on the heap + - Changed NanThrowError(Local) to NanThrowError(Handle) + - Fixed leak in NanAsyncWorker when errmsg is used + +### 0.2.2 Aug 5 2013 + + - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() + +### 0.2.1 Aug 5 2013 + + - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for + NanFromV8String() + +### 0.2.0 Aug 5 2013 + + - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, + NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY + - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, + _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, + _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, + _NAN_PROPERTY_QUERY_ARGS + - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer + - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, + NAN_WEAK_CALLBACK_DATA, NanMakeWeak + - Renamed THROW_ERROR to _NAN_THROW_ERROR + - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) + - Added NanBufferUse(char*, uint32_t) + - Added NanNewContextHandle(v8::ExtensionConfiguration*, + v8::Handle, v8::Handle) + - Fixed broken NanCallback#GetFunction() + - Added optional encoding and size arguments to NanFromV8String() + - Added NanGetPointerSafe() and NanSetPointerSafe() + - Added initial test suite (to be expanded) + - Allow NanUInt32OptionValue to convert any Number object + +### 0.1.0 Jul 21 2013 + + - Added `NAN_GETTER`, `NAN_SETTER` + - Added `NanThrowError` with single Local argument + - Added `NanNewBufferHandle` with single uint32_t argument + - Added `NanHasInstance(Persistent&, Handle)` + - Added `Local NanCallback#GetFunction()` + - Added `NanCallback#Call(int, Local[])` + - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/nan/LICENSE.md b/node_modules/nan/LICENSE.md new file mode 100644 index 00000000..dddd13d5 --- /dev/null +++ b/node_modules/nan/LICENSE.md @@ -0,0 +1,13 @@ +The MIT License (MIT) +===================== + +Copyright (c) 2018 NAN contributors +----------------------------------- + +*NAN contributors listed at * + +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/nan/README.md b/node_modules/nan/README.md new file mode 100644 index 00000000..9b5f38ab --- /dev/null +++ b/node_modules/nan/README.md @@ -0,0 +1,455 @@ +Native Abstractions for Node.js +=============================== + +**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 and 14.** + +***Current version: 2.14.1*** + +*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)* + +[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/) + +[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](https://travis-ci.org/nodejs/nan) +[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan) + +Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. + +This project also contains some helper utilities that make addon development a bit more pleasant. + + * **[News & Updates](#news)** + * **[Usage](#usage)** + * **[Example](#example)** + * **[API](#api)** + * **[Tests](#tests)** + * **[Known issues](#issues)** + * **[Governance & Contributing](#governance)** + + + +## News & Updates + + + +## Usage + +Simply add **NAN** as a dependency in the *package.json* of your Node addon: + +``` bash +$ npm install --save nan +``` + +Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include ` in your *.cpp* files: + +``` python +"include_dirs" : [ + "` when compiling your addon. + + + +## Example + +Just getting started with Nan? Take a look at the **[Node Add-on Examples](https://github.com/nodejs/node-addon-examples)**. + +Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality. + +For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. + +Yet another example is **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon. + +Also take a look at our comprehensive **[C++ test suite](https://github.com/nodejs/nan/tree/master/test/cpp)** which has a plethora of code snippets for your pasting pleasure. + + + +## API + +Additional to the NAN documentation below, please consult: + +* [The V8 Getting Started * Guide](https://v8.dev/docs/embed) +* [V8 API Documentation](https://v8docs.nodesource.com/) +* [Node Add-on Documentation](https://nodejs.org/api/addons.html) + + + +### JavaScript-accessible methods + +A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. + +In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. + +* **Method argument types** + - Nan::FunctionCallbackInfo + - Nan::PropertyCallbackInfo + - Nan::ReturnValue +* **Method declarations** + - Method declaration + - Getter declaration + - Setter declaration + - Property getter declaration + - Property setter declaration + - Property enumerator declaration + - Property deleter declaration + - Property query declaration + - Index getter declaration + - Index setter declaration + - Index enumerator declaration + - Index deleter declaration + - Index query declaration +* Method and template helpers + - Nan::SetMethod() + - Nan::SetPrototypeMethod() + - Nan::SetAccessor() + - Nan::SetNamedPropertyHandler() + - Nan::SetIndexedPropertyHandler() + - Nan::SetTemplate() + - Nan::SetPrototypeTemplate() + - Nan::SetInstanceTemplate() + - Nan::SetCallHandler() + - Nan::SetCallAsFunctionHandler() + +### Scopes + +A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. + +A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. + +The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. + + - Nan::HandleScope + - Nan::EscapableHandleScope + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). + +### Persistent references + +An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. + +Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. + + - Nan::PersistentBase & v8::PersistentBase + - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits + - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits + - Nan::Persistent + - Nan::Global + - Nan::WeakCallbackInfo + - Nan::WeakCallbackType + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). + +### New + +NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. + + - Nan::New() + - Nan::Undefined() + - Nan::Null() + - Nan::True() + - Nan::False() + - Nan::EmptyString() + + +### Converters + +NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. + + - Nan::To() + +### Maybe Types + +The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. + +* **Maybe Types** + - Nan::MaybeLocal + - Nan::Maybe + - Nan::Nothing + - Nan::Just +* **Maybe Helpers** + - Nan::Call() + - Nan::ToDetailString() + - Nan::ToArrayIndex() + - Nan::Equals() + - Nan::NewInstance() + - Nan::GetFunction() + - Nan::Set() + - Nan::DefineOwnProperty() + - Nan::ForceSet() + - Nan::Get() + - Nan::GetPropertyAttributes() + - Nan::Has() + - Nan::Delete() + - Nan::GetPropertyNames() + - Nan::GetOwnPropertyNames() + - Nan::SetPrototype() + - Nan::ObjectProtoToString() + - Nan::HasOwnProperty() + - Nan::HasRealNamedProperty() + - Nan::HasRealIndexedProperty() + - Nan::HasRealNamedCallbackProperty() + - Nan::GetRealNamedPropertyInPrototypeChain() + - Nan::GetRealNamedProperty() + - Nan::CallAsFunction() + - Nan::CallAsConstructor() + - Nan::GetSourceLine() + - Nan::GetLineNumber() + - Nan::GetStartColumn() + - Nan::GetEndColumn() + - Nan::CloneElementAt() + - Nan::HasPrivate() + - Nan::GetPrivate() + - Nan::SetPrivate() + - Nan::DeletePrivate() + - Nan::MakeMaybe() + +### Script + +NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. + + - Nan::CompileScript() + - Nan::RunScript() + + +### JSON + +The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. + + - Nan::JSON.Parse + - Nan::JSON.Stringify + +Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. + +### Errors + +NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. + +Note that an Error object is simply a specialized form of `v8::Value`. + +Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. + + - Nan::Error() + - Nan::RangeError() + - Nan::ReferenceError() + - Nan::SyntaxError() + - Nan::TypeError() + - Nan::ThrowError() + - Nan::ThrowRangeError() + - Nan::ThrowReferenceError() + - Nan::ThrowSyntaxError() + - Nan::ThrowTypeError() + - Nan::FatalException() + - Nan::ErrnoException() + - Nan::TryCatch + + +### Buffers + +NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. + + - Nan::NewBuffer() + - Nan::CopyBuffer() + - Nan::FreeCallback() + +### Nan::Callback + +`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. + + - Nan::Callback + +### Asynchronous work helpers + +`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. + + - Nan::AsyncWorker + - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker + - Nan::AsyncProgressQueueWorker + - Nan::AsyncQueueWorker + +### Strings & Bytes + +Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. + + - Nan::Encoding + - Nan::Encode() + - Nan::DecodeBytes() + - Nan::DecodeWrite() + + +### Object Wrappers + +The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. + + - Nan::ObjectWrap + + +### V8 internals + +The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. + + - NAN_GC_CALLBACK() + - Nan::AddGCEpilogueCallback() + - Nan::RemoveGCEpilogueCallback() + - Nan::AddGCPrologueCallback() + - Nan::RemoveGCPrologueCallback() + - Nan::GetHeapStatistics() + - Nan::SetCounterFunction() + - Nan::SetCreateHistogramFunction() + - Nan::SetAddHistogramSampleFunction() + - Nan::IdleNotification() + - Nan::LowMemoryNotification() + - Nan::ContextDisposedNotification() + - Nan::GetInternalFieldPointer() + - Nan::SetInternalFieldPointer() + - Nan::AdjustExternalMemory() + + +### Miscellaneous V8 Helpers + + - Nan::Utf8String + - Nan::GetCurrentContext() + - Nan::SetIsolateData() + - Nan::GetIsolateData() + - Nan::TypedArrayContents + + +### Miscellaneous Node Helpers + + - Nan::AsyncResource + - Nan::MakeCallback() + - NAN_MODULE_INIT() + - Nan::Export() + + + + + + +### Tests + +To run the NAN tests do: + +``` sh +npm install +npm run-script rebuild-tests +npm test +``` + +Or just: + +``` sh +npm install +make test +``` + + + +## Known issues + +### Compiling against Node.js 0.12 on OSX + +With new enough compilers available on OSX, the versions of V8 headers corresponding to Node.js 0.12 +do not compile anymore. The error looks something like: + +``` +❯ CXX(target) Release/obj.target/accessors/cpp/accessors.o +In file included from ../cpp/accessors.cpp:9: +In file included from ../../nan.h:51: +In file included from /Users/ofrobots/.node-gyp/0.12.18/include/node/node.h:61: +/Users/ofrobots/.node-gyp/0.12.18/include/node/v8.h:5800:54: error: 'CreateHandle' is a protected member of 'v8::HandleScope' + return Handle(reinterpret_cast(HandleScope::CreateHandle( + ~~~~~~~~~~~~~^~~~~~~~~~~~ +``` + +This can be worked around by patching your local versions of v8.h corresponding to Node 0.12 to make +`v8::Handle` a friend of `v8::HandleScope`. Since neither Node.js not V8 support this release line anymore +this patch cannot be released by either project in an official release. + +For this reason, we do not test against Node.js 0.12 on OSX in this project's CI. If you need to support +that configuration, you will need to either get an older compiler, or apply a source patch to the version +of V8 headers as a workaround. + + + +## Governance & Contributing + +NAN is governed by the [Node.js Addon API Working Group](https://github.com/nodejs/CTC/blob/master/WORKING_GROUPS.md#addon-api) + +### Addon API Working Group (WG) + +The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project. + +Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other Node.js projects. + +The WG has final authority over this project including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Maintaining the list of additional Collaborators + +For the current list of WG members, see the project [README.md](./README.md#collaborators). + +Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote. + +_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly. + +For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators). + +### Consensus Seeking Process + +The WG follows a [Consensus Seeking](https://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model. + +Modifications of the contents of the NAN 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 WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification. + +If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins. + + + +## 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. + + + +### WG Members / Collaborators + + + + + + + + + + +
Rod VaggGitHub/rvaggTwitter/@rvagg
Benjamin ByholmGitHub/kkoopa-
Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate
Brett LawsonGitHub/brett19Twitter/@brett19x
Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis
David SiegelGitHub/agnatTwitter/@agnat
Michael Ira KrufkyGitHub/mkrufkyTwitter/@mkrufky
+ +## Licence & copyright + +Copyright (c) 2018 NAN WG Members / Collaborators (listed above). + +Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/nan/doc/asyncworker.md b/node_modules/nan/doc/asyncworker.md new file mode 100644 index 00000000..04231f83 --- /dev/null +++ b/node_modules/nan/doc/asyncworker.md @@ -0,0 +1,146 @@ +## Asynchronous work helpers + +`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. + + - Nan::AsyncWorker + - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker + - Nan::AsyncProgressQueueWorker + - Nan::AsyncQueueWorker + + +### Nan::AsyncWorker + +`Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress. + +This class internally handles the details of creating an [`AsyncResource`][AsyncResource], and running the callback in the +correct async context. To be able to identify the async resources created by this class in async-hooks, provide a +`resource_name` to the constructor. It is recommended that the module name be used as a prefix to the `resource_name` to avoid +collisions in the names. For more details see [`AsyncResource`][AsyncResource] documentation. The `resource_name` needs to stay valid for the lifetime of the worker instance. + +Definition: + +```c++ +class AsyncWorker { + public: + explicit AsyncWorker(Callback *callback_, const char* resource_name = "nan:AsyncWorker"); + + virtual ~AsyncWorker(); + + virtual void WorkComplete(); + + void SaveToPersistent(const char *key, const v8::Local &value); + + void SaveToPersistent(const v8::Local &key, + const v8::Local &value); + + void SaveToPersistent(uint32_t index, + const v8::Local &value); + + v8::Local GetFromPersistent(const char *key) const; + + v8::Local GetFromPersistent(const v8::Local &key) const; + + v8::Local GetFromPersistent(uint32_t index) const; + + virtual void Execute() = 0; + + uv_work_t request; + + virtual void Destroy(); + + protected: + Persistent persistentHandle; + + Callback *callback; + + virtual void HandleOKCallback(); + + virtual void HandleErrorCallback(); + + void SetErrorMessage(const char *msg); + + const char* ErrorMessage(); +}; +``` + + +### Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker + +`Nan::AsyncProgressWorkerBase` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. + +Previously the definition of `Nan::AsyncProgressWorker` only allowed sending `const char` data. Now extending `Nan::AsyncProgressWorker` will yield an instance of the implicit `Nan::AsyncProgressWorkerBase` template with type `` for compatibility. + +`Nan::AsyncProgressWorkerBase` & `Nan::AsyncProgressWorker` is intended for best-effort delivery of nonessential progress messages, e.g. a progress bar. The last event sent before the main thread is woken will be delivered. + +Definition: + +```c++ +template +class AsyncProgressWorkerBase : public AsyncWorker { + public: + explicit AsyncProgressWorkerBase(Callback *callback_, const char* resource_name = ...); + + virtual ~AsyncProgressWorkerBase(); + + void WorkProgress(); + + class ExecutionProgress { + public: + void Signal() const; + void Send(const T* data, size_t count) const; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + + virtual void HandleProgressCallback(const T *data, size_t count) = 0; + + virtual void Destroy(); +}; + +typedef AsyncProgressWorkerBase AsyncProgressWorker; +``` + + +### Nan::AsyncProgressQueueWorker + +`Nan::AsyncProgressQueueWorker` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. + +`Nan::AsyncProgressQueueWorker` behaves exactly the same as `Nan::AsyncProgressWorker`, except all events are queued and delivered to the main thread. + +Definition: + +```c++ +template +class AsyncProgressQueueWorker : public AsyncWorker { + public: + explicit AsyncProgressQueueWorker(Callback *callback_, const char* resource_name = "nan:AsyncProgressQueueWorker"); + + virtual ~AsyncProgressQueueWorker(); + + void WorkProgress(); + + class ExecutionProgress { + public: + void Send(const T* data, size_t count) const; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + + virtual void HandleProgressCallback(const T *data, size_t count) = 0; + + virtual void Destroy(); +}; +``` + + +### Nan::AsyncQueueWorker + +`Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`. + +Definition: + +```c++ +void AsyncQueueWorker(AsyncWorker *); +``` + +[AsyncResource]: node_misc.md#api_nan_asyncresource diff --git a/node_modules/nan/doc/buffers.md b/node_modules/nan/doc/buffers.md new file mode 100644 index 00000000..8d8d25cf --- /dev/null +++ b/node_modules/nan/doc/buffers.md @@ -0,0 +1,54 @@ +## Buffers + +NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. + + - Nan::NewBuffer() + - Nan::CopyBuffer() + - Nan::FreeCallback() + + +### Nan::NewBuffer() + +Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`. + +Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management. +When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`. +You _must not_ free the memory space manually once you have created a `Buffer` in this way. + +Signature: + +```c++ +Nan::MaybeLocal Nan::NewBuffer(uint32_t size) +Nan::MaybeLocal Nan::NewBuffer(char* data, uint32_t size) +Nan::MaybeLocal Nan::NewBuffer(char *data, + size_t length, + Nan::FreeCallback callback, + void *hint) +``` + + + +### Nan::CopyBuffer() + +Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`. + +Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CopyBuffer(const char *data, uint32_t size) +``` + + + +### Nan::FreeCallback() + +A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer). +The supplied callback will be invoked when the `Buffer` undergoes garbage collection. + +Signature: + +```c++ +typedef void (*FreeCallback)(char *data, void *hint); +``` diff --git a/node_modules/nan/doc/callback.md b/node_modules/nan/doc/callback.md new file mode 100644 index 00000000..f7af0bfd --- /dev/null +++ b/node_modules/nan/doc/callback.md @@ -0,0 +1,76 @@ +## Nan::Callback + +`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. + + - Nan::Callback + + +### Nan::Callback + +```c++ +class Callback { + public: + Callback(); + + explicit Callback(const v8::Local &fn); + + ~Callback(); + + bool operator==(const Callback &other) const; + + bool operator!=(const Callback &other) const; + + v8::Local operator*() const; + + MaybeLocal operator()(AsyncResource* async_resource, + v8::Local target, + int argc = 0, + v8::Local argv[] = 0) const; + + MaybeLocal operator()(AsyncResource* async_resource, + int argc = 0, + v8::Local argv[] = 0) const; + + void SetFunction(const v8::Local &fn); + + v8::Local GetFunction() const; + + bool IsEmpty() const; + + void Reset(const v8::Local &fn); + + void Reset(); + + MaybeLocal Call(v8::Local target, + int argc, + v8::Local argv[], + AsyncResource* async_resource) const; + MaybeLocal Call(int argc, + v8::Local argv[], + AsyncResource* async_resource) const; + + // Deprecated versions. Use the versions that accept an async_resource instead + // as they run the callback in the correct async context as specified by the + // resource. If you want to call a synchronous JS function (i.e. on a + // non-empty JS stack), you can use Nan::Call instead. + v8::Local operator()(v8::Local target, + int argc = 0, + v8::Local argv[] = 0) const; + + v8::Local operator()(int argc = 0, + v8::Local argv[] = 0) const; + v8::Local Call(v8::Local target, + int argc, + v8::Local argv[]) const; + + v8::Local Call(int argc, v8::Local argv[]) const; +}; +``` + +Example usage: + +```c++ +v8::Local function; +Nan::Callback callback(function); +callback.Call(0, 0); +``` diff --git a/node_modules/nan/doc/converters.md b/node_modules/nan/doc/converters.md new file mode 100644 index 00000000..d20861b5 --- /dev/null +++ b/node_modules/nan/doc/converters.md @@ -0,0 +1,41 @@ +## Converters + +NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. + + - Nan::To() + + +### Nan::To() + +Converts a `v8::Local` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly. + +See [maybe_types.md](./maybe_types.md) for more information on `Nan::Maybe` types. + +Signatures: + +```c++ +// V8 types +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); +Nan::MaybeLocal Nan::To(v8::Local val); + +// Native types +Nan::Maybe Nan::To(v8::Local val); +Nan::Maybe Nan::To(v8::Local val); +Nan::Maybe Nan::To(v8::Local val); +Nan::Maybe Nan::To(v8::Local val); +Nan::Maybe Nan::To(v8::Local val); +``` + +### Example + +```c++ +v8::Local val; +Nan::MaybeLocal str = Nan::To(val); +Nan::Maybe d = Nan::To(val); +``` + diff --git a/node_modules/nan/doc/errors.md b/node_modules/nan/doc/errors.md new file mode 100644 index 00000000..843435b2 --- /dev/null +++ b/node_modules/nan/doc/errors.md @@ -0,0 +1,226 @@ +## Errors + +NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. + +Note that an Error object is simply a specialized form of `v8::Value`. + +Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. + + - Nan::Error() + - Nan::RangeError() + - Nan::ReferenceError() + - Nan::SyntaxError() + - Nan::TypeError() + - Nan::ThrowError() + - Nan::ThrowRangeError() + - Nan::ThrowReferenceError() + - Nan::ThrowSyntaxError() + - Nan::ThrowTypeError() + - Nan::FatalException() + - Nan::ErrnoException() + - Nan::TryCatch + + + +### Nan::Error() + +Create a new Error object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an Error object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::Error(const char *msg); +v8::Local Nan::Error(v8::Local msg); +``` + + + +### Nan::RangeError() + +Create a new RangeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an RangeError object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::RangeError(const char *msg); +v8::Local Nan::RangeError(v8::Local msg); +``` + + + +### Nan::ReferenceError() + +Create a new ReferenceError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an ReferenceError object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::ReferenceError(const char *msg); +v8::Local Nan::ReferenceError(v8::Local msg); +``` + + + +### Nan::SyntaxError() + +Create a new SyntaxError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an SyntaxError object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::SyntaxError(const char *msg); +v8::Local Nan::SyntaxError(v8::Local msg); +``` + + + +### Nan::TypeError() + +Create a new TypeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.16/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. + +Note that an TypeError object is simply a specialized form of `v8::Value`. + +Signature: + +```c++ +v8::Local Nan::TypeError(const char *msg); +v8::Local Nan::TypeError(v8::Local msg); +``` + + + +### Nan::ThrowError() + +Throw an Error object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new Error object will be created. + +Signature: + +```c++ +void Nan::ThrowError(const char *msg); +void Nan::ThrowError(v8::Local msg); +void Nan::ThrowError(v8::Local error); +``` + + + +### Nan::ThrowRangeError() + +Throw an RangeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new RangeError object will be created. + +Signature: + +```c++ +void Nan::ThrowRangeError(const char *msg); +void Nan::ThrowRangeError(v8::Local msg); +void Nan::ThrowRangeError(v8::Local error); +``` + + + +### Nan::ThrowReferenceError() + +Throw an ReferenceError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new ReferenceError object will be created. + +Signature: + +```c++ +void Nan::ThrowReferenceError(const char *msg); +void Nan::ThrowReferenceError(v8::Local msg); +void Nan::ThrowReferenceError(v8::Local error); +``` + + + +### Nan::ThrowSyntaxError() + +Throw an SyntaxError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new SyntaxError object will be created. + +Signature: + +```c++ +void Nan::ThrowSyntaxError(const char *msg); +void Nan::ThrowSyntaxError(v8::Local msg); +void Nan::ThrowSyntaxError(v8::Local error); +``` + + + +### Nan::ThrowTypeError() + +Throw an TypeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new TypeError object will be created. + +Signature: + +```c++ +void Nan::ThrowTypeError(const char *msg); +void Nan::ThrowTypeError(v8::Local msg); +void Nan::ThrowTypeError(v8::Local error); +``` + + +### Nan::FatalException() + +Replaces `node::FatalException()` which has a different API across supported versions of Node. For use with [`Nan::TryCatch`](#api_nan_try_catch). + +Signature: + +```c++ +void Nan::FatalException(const Nan::TryCatch& try_catch); +``` + + +### Nan::ErrnoException() + +Replaces `node::ErrnoException()` which has a different API across supported versions of Node. + +Signature: + +```c++ +v8::Local Nan::ErrnoException(int errorno, + const char* syscall = NULL, + const char* message = NULL, + const char* path = NULL); +``` + + + +### Nan::TryCatch + +A simple wrapper around [`v8::TryCatch`](https://v8docs.nodesource.com/node-8.16/d4/dc6/classv8_1_1_try_catch.html) compatible with all supported versions of V8. Can be used as a direct replacement in most cases. See also [`Nan::FatalException()`](#api_nan_fatal_exception) for an internal use compatible with `node::FatalException`. + +Signature: + +```c++ +class Nan::TryCatch { + public: + Nan::TryCatch(); + + bool HasCaught() const; + + bool CanContinue() const; + + v8::Local ReThrow(); + + v8::Local Exception() const; + + // Nan::MaybeLocal for older versions of V8 + v8::MaybeLocal StackTrace() const; + + v8::Local Message() const; + + void Reset(); + + void SetVerbose(bool value); + + void SetCaptureMessage(bool value); +}; +``` + diff --git a/node_modules/nan/doc/json.md b/node_modules/nan/doc/json.md new file mode 100644 index 00000000..d1425978 --- /dev/null +++ b/node_modules/nan/doc/json.md @@ -0,0 +1,62 @@ +## JSON + +The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. + + - Nan::JSON.Parse + - Nan::JSON.Stringify + +Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. + + + +### Nan::JSON.Parse + +A simple wrapper around [`v8::JSON::Parse`](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html#a936310d2540fb630ed37d3ee3ffe4504). + +Definition: + +```c++ +Nan::MaybeLocal Nan::JSON::Parse(v8::Local json_string); +``` + +Use `JSON.Parse(json_string)` to parse a string into a `v8::Value`. + +Example: + +```c++ +v8::Local json_string = Nan::New("{ \"JSON\": \"object\" }").ToLocalChecked(); + +Nan::JSON NanJSON; +Nan::MaybeLocal result = NanJSON.Parse(json_string); +if (!result.IsEmpty()) { + v8::Local val = result.ToLocalChecked(); +} +``` + + + +### Nan::JSON.Stringify + +A simple wrapper around [`v8::JSON::Stringify`](https://v8docs.nodesource.com/node-8.16/da/d6f/classv8_1_1_j_s_o_n.html#a44b255c3531489ce43f6110209138860). + +Definition: + +```c++ +Nan::MaybeLocal Nan::JSON::Stringify(v8::Local json_object, v8::Local gap = v8::Local()); +``` + +Use `JSON.Stringify(value)` to stringify a `v8::Object`. + +Example: + +```c++ +// using `v8::Local val` from the `JSON::Parse` example +v8::Local obj = Nan::To(val).ToLocalChecked(); + +Nan::JSON NanJSON; +Nan::MaybeLocal result = NanJSON.Stringify(obj); +if (!result.IsEmpty()) { + v8::Local stringified = result.ToLocalChecked(); +} +``` + diff --git a/node_modules/nan/doc/maybe_types.md b/node_modules/nan/doc/maybe_types.md new file mode 100644 index 00000000..142851a1 --- /dev/null +++ b/node_modules/nan/doc/maybe_types.md @@ -0,0 +1,583 @@ +## Maybe Types + +The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. + +* **Maybe Types** + - Nan::MaybeLocal + - Nan::Maybe + - Nan::Nothing + - Nan::Just +* **Maybe Helpers** + - Nan::Call() + - Nan::ToDetailString() + - Nan::ToArrayIndex() + - Nan::Equals() + - Nan::NewInstance() + - Nan::GetFunction() + - Nan::Set() + - Nan::DefineOwnProperty() + - Nan::ForceSet() + - Nan::Get() + - Nan::GetPropertyAttributes() + - Nan::Has() + - Nan::Delete() + - Nan::GetPropertyNames() + - Nan::GetOwnPropertyNames() + - Nan::SetPrototype() + - Nan::ObjectProtoToString() + - Nan::HasOwnProperty() + - Nan::HasRealNamedProperty() + - Nan::HasRealIndexedProperty() + - Nan::HasRealNamedCallbackProperty() + - Nan::GetRealNamedPropertyInPrototypeChain() + - Nan::GetRealNamedProperty() + - Nan::CallAsFunction() + - Nan::CallAsConstructor() + - Nan::GetSourceLine() + - Nan::GetLineNumber() + - Nan::GetStartColumn() + - Nan::GetEndColumn() + - Nan::CloneElementAt() + - Nan::HasPrivate() + - Nan::GetPrivate() + - Nan::SetPrivate() + - Nan::DeletePrivate() + - Nan::MakeMaybe() + + +### Nan::MaybeLocal + +A `Nan::MaybeLocal` is a wrapper around [`v8::Local`](https://v8docs.nodesource.com/node-8.16/de/deb/classv8_1_1_local.html) that enforces a check that determines whether the `v8::Local` is empty before it can be used. + +If an API method returns a `Nan::MaybeLocal`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, an empty `Nan::MaybeLocal` is returned. + +Definition: + +```c++ +template class Nan::MaybeLocal { + public: + MaybeLocal(); + + template MaybeLocal(v8::Local that); + + bool IsEmpty() const; + + template bool ToLocal(v8::Local *out); + + // Will crash if the MaybeLocal<> is empty. + v8::Local ToLocalChecked(); + + template v8::Local FromMaybe(v8::Local default_value) const; +}; +``` + +See the documentation for [`v8::MaybeLocal`](https://v8docs.nodesource.com/node-8.16/d8/d7d/classv8_1_1_maybe_local.html) for further details. + + +### Nan::Maybe + +A simple `Nan::Maybe` type, representing an object which may or may not have a value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html. + +If an API method returns a `Nan::Maybe<>`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, a "Nothing" value is returned. + +Definition: + +```c++ +template class Nan::Maybe { + public: + bool IsNothing() const; + bool IsJust() const; + + // Will crash if the Maybe<> is nothing. + T FromJust(); + + T FromMaybe(const T& default_value); + + bool operator==(const Maybe &other); + + bool operator!=(const Maybe &other); +}; +``` + +See the documentation for [`v8::Maybe`](https://v8docs.nodesource.com/node-8.16/d9/d4b/classv8_1_1_maybe.html) for further details. + + +### Nan::Nothing + +Construct an empty `Nan::Maybe` type representing _nothing_. + +```c++ +template Nan::Maybe Nan::Nothing(); +``` + + +### Nan::Just + +Construct a `Nan::Maybe` type representing _just_ a value. + +```c++ +template Nan::Maybe Nan::Just(const T &t); +``` + + +### Nan::Call() + +A helper method for calling a synchronous [`v8::Function#Call()`](https://v8docs.nodesource.com/node-8.16/d5/d54/classv8_1_1_function.html#a9c3d0e4e13ddd7721fce238aa5b94a11) in a way compatible across supported versions of V8. + +For asynchronous callbacks, use Nan::Callback::Call along with an AsyncResource. + +Signature: + +```c++ +Nan::MaybeLocal Nan::Call(v8::Local fun, v8::Local recv, int argc, v8::Local argv[]); +Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, v8::Local recv, + int argc, v8::Local argv[]); +Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, int argc, v8::Local argv[]); +``` + + + +### Nan::ToDetailString() + +A helper method for calling [`v8::Value#ToDetailString()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#a2f9770296dc2c8d274bc8cc0dca243e5) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::ToDetailString(v8::Local val); +``` + + + +### Nan::ToArrayIndex() + +A helper method for calling [`v8::Value#ToArrayIndex()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#acc5bbef3c805ec458470c0fcd6f13493) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::ToArrayIndex(v8::Local val); +``` + + + +### Nan::Equals() + +A helper method for calling [`v8::Value#Equals()`](https://v8docs.nodesource.com/node-8.16/dc/d0a/classv8_1_1_value.html#a08fba1d776a59bbf6864b25f9152c64b) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::Equals(v8::Local a, v8::Local(b)); +``` + + + +### Nan::NewInstance() + +A helper method for calling [`v8::Function#NewInstance()`](https://v8docs.nodesource.com/node-8.16/d5/d54/classv8_1_1_function.html#ae477558b10c14b76ed00e8dbab44ce5b) and [`v8::ObjectTemplate#NewInstance()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#ad605a7543cfbc5dab54cdb0883d14ae4) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::NewInstance(v8::Local h); +Nan::MaybeLocal Nan::NewInstance(v8::Local h, int argc, v8::Local argv[]); +Nan::MaybeLocal Nan::NewInstance(v8::Local h); +``` + + + +### Nan::GetFunction() + +A helper method for calling [`v8::FunctionTemplate#GetFunction()`](https://v8docs.nodesource.com/node-8.16/d8/d83/classv8_1_1_function_template.html#a56d904662a86eca78da37d9bb0ed3705) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetFunction(v8::Local t); +``` + + + +### Nan::Set() + +A helper method for calling [`v8::Object#Set()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a67604ea3734f170c66026064ea808f20) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::Set(v8::Local obj, + v8::Local key, + v8::Local value) +Nan::Maybe Nan::Set(v8::Local obj, + uint32_t index, + v8::Local value); +``` + + + +### Nan::DefineOwnProperty() + +A helper method for calling [`v8::Object#DefineOwnProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a6f76b2ed605cb8f9185b92de0033a820) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::DefineOwnProperty(v8::Local obj, + v8::Local key, + v8::Local value, + v8::PropertyAttribute attribs = v8::None); +``` + + + +### Nan::ForceSet() + +Deprecated, use Nan::DefineOwnProperty(). + +A helper method for calling [`v8::Object#ForceSet()`](https://v8docs.nodesource.com/node-0.12/db/d85/classv8_1_1_object.html#acfbdfd7427b516ebdb5c47c4df5ed96c) in a way compatible across supported versions of V8. + +Signature: + +```c++ +NAN_DEPRECATED Nan::Maybe Nan::ForceSet(v8::Local obj, + v8::Local key, + v8::Local value, + v8::PropertyAttribute attribs = v8::None); +``` + + + +### Nan::Get() + +A helper method for calling [`v8::Object#Get()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a2565f03e736694f6b1e1cf22a0b4eac2) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::Get(v8::Local obj, + v8::Local key); +Nan::MaybeLocal Nan::Get(v8::Local obj, uint32_t index); +``` + + + +### Nan::GetPropertyAttributes() + +A helper method for calling [`v8::Object#GetPropertyAttributes()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a9b898894da3d1db2714fd9325a54fe57) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::GetPropertyAttributes( + v8::Local obj, + v8::Local key); +``` + + + +### Nan::Has() + +A helper method for calling [`v8::Object#Has()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c3d89ea7c2f9afd08965bd7299a41d) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::Has(v8::Local obj, v8::Local key); +Nan::Maybe Nan::Has(v8::Local obj, uint32_t index); +``` + + + +### Nan::Delete() + +A helper method for calling [`v8::Object#Delete()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a48e4a19b2cedff867eecc73ddb7d377f) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::Delete(v8::Local obj, + v8::Local key); +Nan::Maybe Nan::Delete(v8::Local obj, uint32_t index); +``` + + + +### Nan::GetPropertyNames() + +A helper method for calling [`v8::Object#GetPropertyNames()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#aced885270cfd2c956367b5eedc7fbfe8) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetPropertyNames(v8::Local obj); +``` + + + +### Nan::GetOwnPropertyNames() + +A helper method for calling [`v8::Object#GetOwnPropertyNames()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a79a6e4d66049b9aa648ed4dfdb23e6eb) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetOwnPropertyNames(v8::Local obj); +``` + + + +### Nan::SetPrototype() + +A helper method for calling [`v8::Object#SetPrototype()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a442706b22fceda6e6d1f632122a9a9f4) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::SetPrototype(v8::Local obj, + v8::Local prototype); +``` + + + +### Nan::ObjectProtoToString() + +A helper method for calling [`v8::Object#ObjectProtoToString()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab7a92b4dcf822bef72f6c0ac6fea1f0b) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::ObjectProtoToString(v8::Local obj); +``` + + + +### Nan::HasOwnProperty() + +A helper method for calling [`v8::Object#HasOwnProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab7b7245442ca6de1e1c145ea3fd653ff) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasOwnProperty(v8::Local obj, + v8::Local key); +``` + + + +### Nan::HasRealNamedProperty() + +A helper method for calling [`v8::Object#HasRealNamedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ad8b80a59c9eb3c1e6c3cd6c84571f767) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasRealNamedProperty(v8::Local obj, + v8::Local key); +``` + + + +### Nan::HasRealIndexedProperty() + +A helper method for calling [`v8::Object#HasRealIndexedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af94fc1135a5e74a2193fb72c3a1b9855) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasRealIndexedProperty(v8::Local obj, + uint32_t index); +``` + + + +### Nan::HasRealNamedCallbackProperty() + +A helper method for calling [`v8::Object#HasRealNamedCallbackProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af743b7ea132b89f84d34d164d0668811) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasRealNamedCallbackProperty( + v8::Local obj, + v8::Local key); +``` + + + +### Nan::GetRealNamedPropertyInPrototypeChain() + +A helper method for calling [`v8::Object#GetRealNamedPropertyInPrototypeChain()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a8700b1862e6b4783716964ba4d5e6172) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetRealNamedPropertyInPrototypeChain( + v8::Local obj, + v8::Local key); +``` + + + +### Nan::GetRealNamedProperty() + +A helper method for calling [`v8::Object#GetRealNamedProperty()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a84471a824576a5994fdd0ffcbf99ccc0) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetRealNamedProperty(v8::Local obj, + v8::Local key); +``` + + + +### Nan::CallAsFunction() + +A helper method for calling [`v8::Object#CallAsFunction()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ad3ffc36f3dfc3592ce2a96bc047ee2cd) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CallAsFunction(v8::Local obj, + v8::Local recv, + int argc, + v8::Local argv[]); +``` + + + +### Nan::CallAsConstructor() + +A helper method for calling [`v8::Object#CallAsConstructor()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a50d571de50d0b0dfb28795619d07a01b) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CallAsConstructor(v8::Local obj, + int argc, + v8::Local argv[]); +``` + + + +### Nan::GetSourceLine() + +A helper method for calling [`v8::Message#GetSourceLine()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#a849f7a6c41549d83d8159825efccd23a) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetSourceLine(v8::Local msg); +``` + + + +### Nan::GetLineNumber() + +A helper method for calling [`v8::Message#GetLineNumber()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#adbe46c10a88a6565f2732a2d2adf99b9) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::GetLineNumber(v8::Local msg); +``` + + + +### Nan::GetStartColumn() + +A helper method for calling [`v8::Message#GetStartColumn()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#a60ede616ba3822d712e44c7a74487ba6) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::GetStartColumn(v8::Local msg); +``` + + + +### Nan::GetEndColumn() + +A helper method for calling [`v8::Message#GetEndColumn()`](https://v8docs.nodesource.com/node-8.16/d9/d28/classv8_1_1_message.html#aaa004cf19e529da980bc19fcb76d93be) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::GetEndColumn(v8::Local msg); +``` + + + +### Nan::CloneElementAt() + +A helper method for calling [`v8::Array#CloneElementAt()`](https://v8docs.nodesource.com/node-4.8/d3/d32/classv8_1_1_array.html#a1d3a878d4c1c7cae974dd50a1639245e) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CloneElementAt(v8::Local array, uint32_t index); +``` + + +### Nan::HasPrivate() + +A helper method for calling [`v8::Object#HasPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#af68a0b98066cfdeb8f943e98a40ba08d) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::HasPrivate(v8::Local object, v8::Local key); +``` + + +### Nan::GetPrivate() + +A helper method for calling [`v8::Object#GetPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a169f2da506acbec34deadd9149a1925a) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::GetPrivate(v8::Local object, v8::Local key); +``` + + +### Nan::SetPrivate() + +A helper method for calling [`v8::Object#SetPrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ace1769b0f3b86bfe9fda1010916360ee) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::SetPrivate(v8::Local object, v8::Local key, v8::Local value); +``` + + +### Nan::DeletePrivate() + +A helper method for calling [`v8::Object#DeletePrivate()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a138bb32a304f3982be02ad499693b8fd) in a way compatible across supported versions of V8. + +Signature: + +```c++ +Nan::Maybe Nan::DeletePrivate(v8::Local object, v8::Local key); +``` + + +### Nan::MakeMaybe() + +Wraps a `v8::Local<>` in a `Nan::MaybeLocal<>`. When called with a `Nan::MaybeLocal<>` it just returns its argument. This is useful in generic template code that builds on NAN. + +Synopsis: + +```c++ + MaybeLocal someNumber = MakeMaybe(New(3.141592654)); + MaybeLocal someString = MakeMaybe(New("probably")); +``` + +Signature: + +```c++ +template class MaybeMaybe> +Nan::MaybeLocal Nan::MakeMaybe(MaybeMaybe v); +``` diff --git a/node_modules/nan/doc/methods.md b/node_modules/nan/doc/methods.md new file mode 100644 index 00000000..9642d027 --- /dev/null +++ b/node_modules/nan/doc/methods.md @@ -0,0 +1,664 @@ +## JavaScript-accessible methods + +A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. + +In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. + +* **Method argument types** + - Nan::FunctionCallbackInfo + - Nan::PropertyCallbackInfo + - Nan::ReturnValue +* **Method declarations** + - Method declaration + - Getter declaration + - Setter declaration + - Property getter declaration + - Property setter declaration + - Property enumerator declaration + - Property deleter declaration + - Property query declaration + - Index getter declaration + - Index setter declaration + - Index enumerator declaration + - Index deleter declaration + - Index query declaration +* Method and template helpers + - Nan::SetMethod() + - Nan::SetPrototypeMethod() + - Nan::SetAccessor() + - Nan::SetNamedPropertyHandler() + - Nan::SetIndexedPropertyHandler() + - Nan::SetTemplate() + - Nan::SetPrototypeTemplate() + - Nan::SetInstanceTemplate() + - Nan::SetCallHandler() + - Nan::SetCallAsFunctionHandler() + + +### Nan::FunctionCallbackInfo + +`Nan::FunctionCallbackInfo` should be used in place of [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.16/dd/d0d/classv8_1_1_function_callback_info.html), even with older versions of Node where `v8::FunctionCallbackInfo` does not exist. + +Definition: + +```c++ +template class FunctionCallbackInfo { + public: + ReturnValue GetReturnValue() const; + v8::Local Callee(); // NOTE: Not available in NodeJS >= 10.0.0 + v8::Local Data(); + v8::Local Holder(); + bool IsConstructCall(); + int Length() const; + v8::Local operator[](int i) const; + v8::Local This() const; + v8::Isolate *GetIsolate() const; +}; +``` + +See the [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.16/dd/d0d/classv8_1_1_function_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from methods. + +**Note:** `FunctionCallbackInfo::Callee` is removed in Node.js after `10.0.0` because it is was deprecated in V8. Consider using `info.Data()` to pass any information you need. + + +### Nan::PropertyCallbackInfo + +`Nan::PropertyCallbackInfo` should be used in place of [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d7/dc5/classv8_1_1_property_callback_info.html), even with older versions of Node where `v8::PropertyCallbackInfo` does not exist. + +Definition: + +```c++ +template class PropertyCallbackInfo : public PropertyCallbackInfoBase { + public: + ReturnValue GetReturnValue() const; + v8::Isolate* GetIsolate() const; + v8::Local Data() const; + v8::Local This() const; + v8::Local Holder() const; +}; +``` + +See the [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d7/dc5/classv8_1_1_property_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from property accessor methods. + + +### Nan::ReturnValue + +`Nan::ReturnValue` is used in place of [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.16/da/da7/classv8_1_1_return_value.html) on both [`Nan::FunctionCallbackInfo`](#api_nan_function_callback_info) and [`Nan::PropertyCallbackInfo`](#api_nan_property_callback_info) as the return type of `GetReturnValue()`. + +Example usage: + +```c++ +void EmptyArray(const Nan::FunctionCallbackInfo& info) { + info.GetReturnValue().Set(Nan::New()); +} +``` + +Definition: + +```c++ +template class ReturnValue { + public: + // Handle setters + template void Set(const v8::Local &handle); + template void Set(const Nan::Global &handle); + + // Fast primitive setters + void Set(bool value); + void Set(double i); + void Set(int32_t i); + void Set(uint32_t i); + + // Fast JS primitive setters + void SetNull(); + void SetUndefined(); + void SetEmptyString(); + + // Convenience getter for isolate + v8::Isolate *GetIsolate() const; +}; +``` + +See the documentation on [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.16/da/da7/classv8_1_1_return_value.html) for further information on this. + + +### Method declaration + +JavaScript-accessible methods should be declared with the following signature to form a `Nan::FunctionCallback`: + +```c++ +typedef void(*FunctionCallback)(const FunctionCallbackInfo&); +``` + +Example: + +```c++ +void MethodName(const Nan::FunctionCallbackInfo& info) { + ... +} +``` + +You do not need to declare a new `HandleScope` within a method as one is implicitly created for you. + +**Example usage** + +```c++ +// .h: +class Foo : public Nan::ObjectWrap { + ... + + static void Bar(const Nan::FunctionCallbackInfo& info); + static void Baz(const Nan::FunctionCallbackInfo& info); +} + + +// .cc: +void Foo::Bar(const Nan::FunctionCallbackInfo& info) { + ... +} + +void Foo::Baz(const Nan::FunctionCallbackInfo& info) { + ... +} +``` + +A helper macro `NAN_METHOD(methodname)` exists, compatible with NAN v1 method declarations. + +**Example usage with `NAN_METHOD(methodname)`** + +```c++ +// .h: +class Foo : public Nan::ObjectWrap { + ... + + static NAN_METHOD(Bar); + static NAN_METHOD(Baz); +} + + +// .cc: +NAN_METHOD(Foo::Bar) { + ... +} + +NAN_METHOD(Foo::Baz) { + ... +} +``` + +Use [`Nan::SetPrototypeMethod`](#api_nan_set_prototype_method) to attach a method to a JavaScript function prototype or [`Nan::SetMethod`](#api_nan_set_method) to attach a method directly on a JavaScript object. + + +### Getter declaration + +JavaScript-accessible getters should be declared with the following signature to form a `Nan::GetterCallback`: + +```c++ +typedef void(*GetterCallback)(v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void GetterName(v8::Local property, + const Nan::PropertyCallbackInfo& info) { + ... +} +``` + +You do not need to declare a new `HandleScope` within a getter as one is implicitly created for you. + +A helper macro `NAN_GETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). + + +### Setter declaration + +JavaScript-accessible setters should be declared with the following signature to form a Nan::SetterCallback: + +```c++ +typedef void(*SetterCallback)(v8::Local, + v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void SetterName(v8::Local property, + v8::Local value, + const Nan::PropertyCallbackInfo& info) { + ... +} +``` + +You do not need to declare a new `HandleScope` within a setter as one is implicitly created for you. + +A helper macro `NAN_SETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). + + +### Property getter declaration + +JavaScript-accessible property getters should be declared with the following signature to form a Nan::PropertyGetterCallback: + +```c++ +typedef void(*PropertyGetterCallback)(v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertyGetterName(v8::Local property, + const Nan::PropertyCallbackInfo& info) { + ... +} +``` + +You do not need to declare a new `HandleScope` within a property getter as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_GETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Property setter declaration + +JavaScript-accessible property setters should be declared with the following signature to form a Nan::PropertySetterCallback: + +```c++ +typedef void(*PropertySetterCallback)(v8::Local, + v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertySetterName(v8::Local property, + v8::Local value, + const Nan::PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a property setter as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_SETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Property enumerator declaration + +JavaScript-accessible property enumerators should be declared with the following signature to form a Nan::PropertyEnumeratorCallback: + +```c++ +typedef void(*PropertyEnumeratorCallback)(const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertyEnumeratorName(const Nan::PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a property enumerator as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Property deleter declaration + +JavaScript-accessible property deleters should be declared with the following signature to form a Nan::PropertyDeleterCallback: + +```c++ +typedef void(*PropertyDeleterCallback)(v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertyDeleterName(v8::Local property, + const Nan::PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a property deleter as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_DELETER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Property query declaration + +JavaScript-accessible property query methods should be declared with the following signature to form a Nan::PropertyQueryCallback: + +```c++ +typedef void(*PropertyQueryCallback)(v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void PropertyQueryName(v8::Local property, + const Nan::PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a property query method as one is implicitly created for you. + +A helper macro `NAN_PROPERTY_QUERY(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index getter declaration + +JavaScript-accessible index getter methods should be declared with the following signature to form a Nan::IndexGetterCallback: + +```c++ +typedef void(*IndexGetterCallback)(uint32_t, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexGetterName(uint32_t index, const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index getter as one is implicitly created for you. + +A helper macro `NAN_INDEX_GETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index setter declaration + +JavaScript-accessible index setter methods should be declared with the following signature to form a Nan::IndexSetterCallback: + +```c++ +typedef void(*IndexSetterCallback)(uint32_t, + v8::Local, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexSetterName(uint32_t index, + v8::Local value, + const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index setter as one is implicitly created for you. + +A helper macro `NAN_INDEX_SETTER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index enumerator declaration + +JavaScript-accessible index enumerator methods should be declared with the following signature to form a Nan::IndexEnumeratorCallback: + +```c++ +typedef void(*IndexEnumeratorCallback)(const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexEnumeratorName(const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index enumerator as one is implicitly created for you. + +A helper macro `NAN_INDEX_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index deleter declaration + +JavaScript-accessible index deleter methods should be declared with the following signature to form a Nan::IndexDeleterCallback: + +```c++ +typedef void(*IndexDeleterCallback)(uint32_t, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexDeleterName(uint32_t index, const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index deleter as one is implicitly created for you. + +A helper macro `NAN_INDEX_DELETER(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Index query declaration + +JavaScript-accessible index query methods should be declared with the following signature to form a Nan::IndexQueryCallback: + +```c++ +typedef void(*IndexQueryCallback)(uint32_t, + const PropertyCallbackInfo&); +``` + +Example: + +```c++ +void IndexQueryName(uint32_t index, const PropertyCallbackInfo& info); +``` + +You do not need to declare a new `HandleScope` within a index query method as one is implicitly created for you. + +A helper macro `NAN_INDEX_QUERY(methodname)` exists, compatible with NAN v1 method declarations. + +Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). + + +### Nan::SetMethod() + +Sets a method with a given name directly on a JavaScript object where the method has the `Nan::FunctionCallback` signature (see Method declaration). + +Signature: + +```c++ +void Nan::SetMethod(v8::Local recv, + const char *name, + Nan::FunctionCallback callback, + v8::Local data = v8::Local()) +void Nan::SetMethod(v8::Local templ, + const char *name, + Nan::FunctionCallback callback, + v8::Local data = v8::Local()) +``` + + +### Nan::SetPrototypeMethod() + +Sets a method with a given name on a `FunctionTemplate`'s prototype where the method has the `Nan::FunctionCallback` signature (see Method declaration). + +Signature: + +```c++ +void Nan::SetPrototypeMethod(v8::Local recv, + const char* name, + Nan::FunctionCallback callback, + v8::Local data = v8::Local()) +``` + + +### Nan::SetAccessor() + +Sets getters and setters for a property with a given name on an `ObjectTemplate` or a plain `Object`. Accepts getters with the `Nan::GetterCallback` signature (see Getter declaration) and setters with the `Nan::SetterCallback` signature (see Setter declaration). + +Signature: + +```c++ +void SetAccessor(v8::Local tpl, + v8::Local name, + Nan::GetterCallback getter, + Nan::SetterCallback setter = 0, + v8::Local data = v8::Local(), + v8::AccessControl settings = v8::DEFAULT, + v8::PropertyAttribute attribute = v8::None, + imp::Sig signature = imp::Sig()); +bool SetAccessor(v8::Local obj, + v8::Local name, + Nan::GetterCallback getter, + Nan::SetterCallback setter = 0, + v8::Local data = v8::Local(), + v8::AccessControl settings = v8::DEFAULT, + v8::PropertyAttribute attribute = v8::None) +``` + +See the V8 [`ObjectTemplate#SetAccessor()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#aca0ed196f8a9adb1f68b1aadb6c9cd77) and [`Object#SetAccessor()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ae91b3b56b357f285288c89fbddc46d1b) for further information about how to use `Nan::SetAccessor()`. + + +### Nan::SetNamedPropertyHandler() + +Sets named property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: + +* Property getters with the `Nan::PropertyGetterCallback` signature (see Property getter declaration) +* Property setters with the `Nan::PropertySetterCallback` signature (see Property setter declaration) +* Property query methods with the `Nan::PropertyQueryCallback` signature (see Property query declaration) +* Property deleters with the `Nan::PropertyDeleterCallback` signature (see Property deleter declaration) +* Property enumerators with the `Nan::PropertyEnumeratorCallback` signature (see Property enumerator declaration) + +Signature: + +```c++ +void SetNamedPropertyHandler(v8::Local tpl, + Nan::PropertyGetterCallback getter, + Nan::PropertySetterCallback setter = 0, + Nan::PropertyQueryCallback query = 0, + Nan::PropertyDeleterCallback deleter = 0, + Nan::PropertyEnumeratorCallback enumerator = 0, + v8::Local data = v8::Local()) +``` + +See the V8 [`ObjectTemplate#SetNamedPropertyHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#a33b3ebd7de641f6cc6414b7de01fc1c7) for further information about how to use `Nan::SetNamedPropertyHandler()`. + + +### Nan::SetIndexedPropertyHandler() + +Sets indexed property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: + +* Indexed property getters with the `Nan::IndexGetterCallback` signature (see Index getter declaration) +* Indexed property setters with the `Nan::IndexSetterCallback` signature (see Index setter declaration) +* Indexed property query methods with the `Nan::IndexQueryCallback` signature (see Index query declaration) +* Indexed property deleters with the `Nan::IndexDeleterCallback` signature (see Index deleter declaration) +* Indexed property enumerators with the `Nan::IndexEnumeratorCallback` signature (see Index enumerator declaration) + +Signature: + +```c++ +void SetIndexedPropertyHandler(v8::Local tpl, + Nan::IndexGetterCallback getter, + Nan::IndexSetterCallback setter = 0, + Nan::IndexQueryCallback query = 0, + Nan::IndexDeleterCallback deleter = 0, + Nan::IndexEnumeratorCallback enumerator = 0, + v8::Local data = v8::Local()) +``` + +See the V8 [`ObjectTemplate#SetIndexedPropertyHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#ac89f06d634add0e890452033f7d17ff1) for further information about how to use `Nan::SetIndexedPropertyHandler()`. + + +### Nan::SetTemplate() + +Adds properties on an `Object`'s or `Function`'s template. + +Signature: + +```c++ +void Nan::SetTemplate(v8::Local templ, + const char *name, + v8::Local value); +void Nan::SetTemplate(v8::Local templ, + v8::Local name, + v8::Local value, + v8::PropertyAttribute attributes) +``` + +Calls the `Template`'s [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#ae3fbaff137557aa6a0233bc7e52214ac). + + +### Nan::SetPrototypeTemplate() + +Adds properties on an `Object`'s or `Function`'s prototype template. + +Signature: + +```c++ +void Nan::SetPrototypeTemplate(v8::Local templ, + const char *name, + v8::Local value); +void Nan::SetPrototypeTemplate(v8::Local templ, + v8::Local name, + v8::Local value, + v8::PropertyAttribute attributes) +``` + +Calls the `FunctionTemplate`'s _PrototypeTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). + + +### Nan::SetInstanceTemplate() + +Use to add instance properties on `FunctionTemplate`'s. + +Signature: + +```c++ +void Nan::SetInstanceTemplate(v8::Local templ, + const char *name, + v8::Local value); +void Nan::SetInstanceTemplate(v8::Local templ, + v8::Local name, + v8::Local value, + v8::PropertyAttribute attributes) +``` + +Calls the `FunctionTemplate`'s _InstanceTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.16/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). + + +### Nan::SetCallHandler() + +Set the call-handler callback for a `v8::FunctionTemplate`. +This callback is called whenever the function created from this FunctionTemplate is called. + +Signature: + +```c++ +void Nan::SetCallHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) +``` + +Calls the `FunctionTemplate`'s [`SetCallHandler()`](https://v8docs.nodesource.com/node-8.16/d8/d83/classv8_1_1_function_template.html#ab7574b298db3c27fbc2ed465c08ea2f8). + + +### Nan::SetCallAsFunctionHandler() + +Sets the callback to be used when calling instances created from the `v8::ObjectTemplate` as a function. +If no callback is set, instances behave like normal JavaScript objects that cannot be called as a function. + +Signature: + +```c++ +void Nan::SetCallAsFunctionHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) +``` + +Calls the `ObjectTemplate`'s [`SetCallAsFunctionHandler()`](https://v8docs.nodesource.com/node-8.16/db/d5f/classv8_1_1_object_template.html#a5e9612fc80bf6db8f2da199b9b0bd04e). + diff --git a/node_modules/nan/doc/new.md b/node_modules/nan/doc/new.md new file mode 100644 index 00000000..0f28a0e9 --- /dev/null +++ b/node_modules/nan/doc/new.md @@ -0,0 +1,147 @@ +## New + +NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. + + - Nan::New() + - Nan::Undefined() + - Nan::Null() + - Nan::True() + - Nan::False() + - Nan::EmptyString() + + + +### Nan::New() + +`Nan::New()` should be used to instantiate new JavaScript objects. + +Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/node-8.16/d1/d83/classv8_1_1_data.html) for information on the types of arguments required for instantiation. + +Signatures: + +Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a `v8::Local`. The following types will be contained within a `Nan::MaybeLocal`: `v8::String`, `v8::Date`, `v8::RegExp`, `v8::Script`, `v8::UnboundScript`. + +Empty objects: + +```c++ +Nan::New(); +``` + +Generic single and multiple-argument: + +```c++ +Nan::New(A0 arg0); +Nan::New(A0 arg0, A1 arg1); +Nan::New(A0 arg0, A1 arg1, A2 arg2); +Nan::New(A0 arg0, A1 arg1, A2 arg2, A3 arg3); +``` + +For creating `v8::FunctionTemplate` and `v8::Function` objects: + +_The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._ + +```c++ +Nan::New(Nan::FunctionCallback callback, + v8::Local data = v8::Local()); +Nan::New(Nan::FunctionCallback callback, + v8::Local data = v8::Local(), + A2 a2 = A2()); +``` + +Native number types: + +```c++ +v8::Local Nan::New(bool value); +v8::Local Nan::New(int32_t value); +v8::Local Nan::New(uint32_t value); +v8::Local Nan::New(double value); +``` + +String types: + +```c++ +Nan::MaybeLocal Nan::New(std::string const& value); +Nan::MaybeLocal Nan::New(const char * value, int length); +Nan::MaybeLocal Nan::New(const char * value); +Nan::MaybeLocal Nan::New(const uint16_t * value); +Nan::MaybeLocal Nan::New(const uint16_t * value, int length); +``` + +Specialized types: + +```c++ +v8::Local Nan::New(v8::String::ExternalStringResource * value); +v8::Local Nan::New(Nan::ExternalOneByteStringResource * value); +v8::Local Nan::New(v8::Local pattern, v8::RegExp::Flags flags); +``` + +Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/node-8.16/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8. + + + +### Nan::Undefined() + +A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::Undefined() +``` + + +### Nan::Null() + +A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::Null() +``` + + +### Nan::True() + +A helper method to reference the `v8::Boolean` object representing the `true` value in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::True() +``` + + +### Nan::False() + +A helper method to reference the `v8::Boolean` object representing the `false` value in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::False() +``` + + +### Nan::EmptyString() + +Call [`v8::String::Empty`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::EmptyString() +``` + + + +### Nan::NewOneByteString() + +An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/node-8.16/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data. + +Signature: + +```c++ +Nan::MaybeLocal Nan::NewOneByteString(const uint8_t * value, + int length = -1) +``` diff --git a/node_modules/nan/doc/node_misc.md b/node_modules/nan/doc/node_misc.md new file mode 100644 index 00000000..17578e34 --- /dev/null +++ b/node_modules/nan/doc/node_misc.md @@ -0,0 +1,123 @@ +## Miscellaneous Node Helpers + + - Nan::AsyncResource + - Nan::MakeCallback() + - NAN_MODULE_INIT() + - Nan::Export() + + +### Nan::AsyncResource + +This class is analogous to the `AsyncResource` JavaScript class exposed by Node's [async_hooks][] API. + +When calling back into JavaScript asynchronously, special care must be taken to ensure that the runtime can properly track +async hops. `Nan::AsyncResource` is a class that provides an RAII wrapper around `node::EmitAsyncInit`, `node::EmitAsyncDestroy`, +and `node::MakeCallback`. Using this mechanism to call back into JavaScript, as opposed to `Nan::MakeCallback` or +`v8::Function::Call` ensures that the callback is executed in the correct async context. This ensures that async mechanisms +such as domains and [async_hooks][] function correctly. + +Definition: + +```c++ +class AsyncResource { + public: + AsyncResource(v8::Local name, + v8::Local resource = New()); + AsyncResource(const char* name, + v8::Local resource = New()); + ~AsyncResource(); + + v8::MaybeLocal runInAsyncScope(v8::Local target, + v8::Local func, + int argc, + v8::Local* argv); + v8::MaybeLocal runInAsyncScope(v8::Local target, + v8::Local symbol, + int argc, + v8::Local* argv); + v8::MaybeLocal runInAsyncScope(v8::Local target, + const char* method, + int argc, + v8::Local* argv); +}; +``` + +* `name`: Identifier for the kind of resource that is being provided for diagnostics information exposed by the [async_hooks][] + API. This will be passed to the possible `init` hook as the `type`. To avoid name collisions with other modules we recommend + that the name include the name of the owning module as a prefix. For example `mysql` module could use something like + `mysql:batch-db-query-resource`. +* `resource`: An optional object associated with the async work that will be passed to the possible [async_hooks][] + `init` hook. If this parameter is omitted, or an empty handle is provided, this object will be created automatically. +* When calling JS on behalf of this resource, one can use `runInAsyncScope`. This will ensure that the callback runs in the + correct async execution context. +* `AsyncDestroy` is automatically called when an AsyncResource object is destroyed. + +For more details, see the Node [async_hooks][] documentation. You might also want to take a look at the documentation for the +[N-API counterpart][napi]. For example usage, see the `asyncresource.cpp` example in the `test/cpp` directory. + + +### Nan::MakeCallback() + +Deprecated wrappers around the legacy `node::MakeCallback()` APIs. Node.js 10+ +has deprecated these legacy APIs as they do not provide a mechanism to preserve +async context. + +We recommend that you use the `AsyncResource` class and `AsyncResource::runInAsyncScope` instead of using `Nan::MakeCallback` or +`v8::Function#Call()` directly. `AsyncResource` properly takes care of running the callback in the correct async execution +context – something that is essential for functionality like domains, async_hooks and async debugging. + +Signatures: + +```c++ +NAN_DEPRECATED +v8::Local Nan::MakeCallback(v8::Local target, + v8::Local func, + int argc, + v8::Local* argv); +NAN_DEPRECATED +v8::Local Nan::MakeCallback(v8::Local target, + v8::Local symbol, + int argc, + v8::Local* argv); +NAN_DEPRECATED +v8::Local Nan::MakeCallback(v8::Local target, + const char* method, + int argc, + v8::Local* argv); +``` + + + +### NAN_MODULE_INIT() + +Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object. + +See example below. + + +### Nan::Export() + +A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript. + +Signature: + +```c++ +void Export(v8::Local target, const char *name, Nan::FunctionCallback f) +``` + +Also available as the shortcut `NAN_EXPORT` macro. + +Example: + +```c++ +NAN_METHOD(Foo) { + ... +} + +NAN_MODULE_INIT(Init) { + NAN_EXPORT(target, Foo); +} +``` + +[async_hooks]: https://nodejs.org/dist/latest-v9.x/docs/api/async_hooks.html +[napi]: https://nodejs.org/dist/latest-v9.x/docs/api/n-api.html#n_api_custom_asynchronous_operations diff --git a/node_modules/nan/doc/object_wrappers.md b/node_modules/nan/doc/object_wrappers.md new file mode 100644 index 00000000..07d8c058 --- /dev/null +++ b/node_modules/nan/doc/object_wrappers.md @@ -0,0 +1,263 @@ +## Object Wrappers + +The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. + + - Nan::ObjectWrap + + + +### Nan::ObjectWrap() + +A reimplementation of `node::ObjectWrap` that adds some API not present in older versions of Node. Should be preferred over `node::ObjectWrap` in all cases for consistency. + +Definition: + +```c++ +class ObjectWrap { + public: + ObjectWrap(); + + virtual ~ObjectWrap(); + + template + static inline T* Unwrap(v8::Local handle); + + inline v8::Local handle(); + + inline Nan::Persistent& persistent(); + + protected: + inline void Wrap(v8::Local handle); + + inline void MakeWeak(); + + /* Ref() marks the object as being attached to an event loop. + * Refed objects will not be garbage collected, even if + * all references are lost. + */ + virtual void Ref(); + + /* Unref() marks an object as detached from the event loop. This is its + * default state. When an object with a "weak" reference changes from + * attached to detached state it will be freed. Be careful not to access + * the object after making this call as it might be gone! + * (A "weak reference" means an object that only has a + * persistent handle.) + * + * DO NOT CALL THIS FROM DESTRUCTOR + */ + virtual void Unref(); + + int refs_; // ro +}; +``` + +See the Node documentation on [Wrapping C++ Objects](https://nodejs.org/api/addons.html#addons_wrapping_c_objects) for more details. + +### This vs. Holder + +When calling `Unwrap`, it is important that the argument is indeed some JavaScript object which got wrapped by a `Wrap` call for this class or any derived class. +The `Signature` installed by [`Nan::SetPrototypeMethod()`](methods.md#api_nan_set_prototype_method) does ensure that `info.Holder()` is just such an instance. +In Node 0.12 and later, `info.This()` will also be of such a type, since otherwise the invocation will get rejected. +However, in Node 0.10 and before it was possible to invoke a method on a JavaScript object which just had the extension type in its prototype chain. +In such a situation, calling `Unwrap` on `info.This()` will likely lead to a failed assertion causing a crash, but could lead to even more serious corruption. + +On the other hand, calling `Unwrap` in an [accessor](methods.md#api_nan_set_accessor) should not use `Holder()` if the accessor is defined on the prototype. +So either define your accessors on the instance template, +or use `This()` after verifying that it is indeed a valid object. + +### Examples + +#### Basic + +```c++ +class MyObject : public Nan::ObjectWrap { + public: + static NAN_MODULE_INIT(Init) { + v8::Local tpl = Nan::New(New); + tpl->SetClassName(Nan::New("MyObject").ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Nan::SetPrototypeMethod(tpl, "getHandle", GetHandle); + Nan::SetPrototypeMethod(tpl, "getValue", GetValue); + + constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); + Nan::Set(target, Nan::New("MyObject").ToLocalChecked(), + Nan::GetFunction(tpl).ToLocalChecked()); + } + + private: + explicit MyObject(double value = 0) : value_(value) {} + ~MyObject() {} + + static NAN_METHOD(New) { + if (info.IsConstructCall()) { + double value = info[0]->IsUndefined() ? 0 : Nan::To(info[0]).FromJust(); + MyObject *obj = new MyObject(value); + obj->Wrap(info.This()); + info.GetReturnValue().Set(info.This()); + } else { + const int argc = 1; + v8::Local argv[argc] = {info[0]}; + v8::Local cons = Nan::New(constructor()); + info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); + } + } + + static NAN_METHOD(GetHandle) { + MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(obj->handle()); + } + + static NAN_METHOD(GetValue) { + MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(obj->value_); + } + + static inline Nan::Persistent & constructor() { + static Nan::Persistent my_constructor; + return my_constructor; + } + + double value_; +}; + +NODE_MODULE(objectwrapper, MyObject::Init) +``` + +To use in Javascript: + +```Javascript +var objectwrapper = require('bindings')('objectwrapper'); + +var obj = new objectwrapper.MyObject(5); +console.log('Should be 5: ' + obj.getValue()); +``` + +#### Factory of wrapped objects + +```c++ +class MyFactoryObject : public Nan::ObjectWrap { + public: + static NAN_MODULE_INIT(Init) { + v8::Local tpl = Nan::New(New); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Nan::SetPrototypeMethod(tpl, "getValue", GetValue); + + constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); + } + + static NAN_METHOD(NewInstance) { + v8::Local cons = Nan::New(constructor()); + double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; + const int argc = 1; + v8::Local argv[1] = {Nan::New(value)}; + info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); + } + + // Needed for the next example: + inline double value() const { + return value_; + } + + private: + explicit MyFactoryObject(double value = 0) : value_(value) {} + ~MyFactoryObject() {} + + static NAN_METHOD(New) { + if (info.IsConstructCall()) { + double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; + MyFactoryObject * obj = new MyFactoryObject(value); + obj->Wrap(info.This()); + info.GetReturnValue().Set(info.This()); + } else { + const int argc = 1; + v8::Local argv[argc] = {info[0]}; + v8::Local cons = Nan::New(constructor()); + info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); + } + } + + static NAN_METHOD(GetValue) { + MyFactoryObject* obj = ObjectWrap::Unwrap(info.Holder()); + info.GetReturnValue().Set(obj->value_); + } + + static inline Nan::Persistent & constructor() { + static Nan::Persistent my_constructor; + return my_constructor; + } + + double value_; +}; + +NAN_MODULE_INIT(Init) { + MyFactoryObject::Init(target); + Nan::Set(target, + Nan::New("newFactoryObjectInstance").ToLocalChecked(), + Nan::GetFunction( + Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() + ); +} + +NODE_MODULE(wrappedobjectfactory, Init) +``` + +To use in Javascript: + +```Javascript +var wrappedobjectfactory = require('bindings')('wrappedobjectfactory'); + +var obj = wrappedobjectfactory.newFactoryObjectInstance(10); +console.log('Should be 10: ' + obj.getValue()); +``` + +#### Passing wrapped objects around + +Use the `MyFactoryObject` class above along with the following: + +```c++ +static NAN_METHOD(Sum) { + Nan::MaybeLocal maybe1 = Nan::To(info[0]); + Nan::MaybeLocal maybe2 = Nan::To(info[1]); + + // Quick check: + if (maybe1.IsEmpty() || maybe2.IsEmpty()) { + // return value is undefined by default + return; + } + + MyFactoryObject* obj1 = + Nan::ObjectWrap::Unwrap(maybe1.ToLocalChecked()); + MyFactoryObject* obj2 = + Nan::ObjectWrap::Unwrap(maybe2.ToLocalChecked()); + + info.GetReturnValue().Set(Nan::New(obj1->value() + obj2->value())); +} + +NAN_MODULE_INIT(Init) { + MyFactoryObject::Init(target); + Nan::Set(target, + Nan::New("newFactoryObjectInstance").ToLocalChecked(), + Nan::GetFunction( + Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() + ); + Nan::Set(target, + Nan::New("sum").ToLocalChecked(), + Nan::GetFunction(Nan::New(Sum)).ToLocalChecked() + ); +} + +NODE_MODULE(myaddon, Init) +``` + +To use in Javascript: + +```Javascript +var myaddon = require('bindings')('myaddon'); + +var obj1 = myaddon.newFactoryObjectInstance(5); +var obj2 = myaddon.newFactoryObjectInstance(10); +console.log('sum of object values: ' + myaddon.sum(obj1, obj2)); +``` diff --git a/node_modules/nan/doc/persistent.md b/node_modules/nan/doc/persistent.md new file mode 100644 index 00000000..2e13f6bb --- /dev/null +++ b/node_modules/nan/doc/persistent.md @@ -0,0 +1,296 @@ +## Persistent references + +An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. + +Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. + + - Nan::PersistentBase & v8::PersistentBase + - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits + - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits + - Nan::Persistent + - Nan::Global + - Nan::WeakCallbackInfo + - Nan::WeakCallbackType + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). + + +### Nan::PersistentBase & v8::PersistentBase + +A persistent handle contains a reference to a storage cell in V8 which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or `Nan::PersistentBase::Reset()`. Existing handles can be disposed using an argument-less `Nan::PersistentBase::Reset()`. + +Definition: + +_(note: this is implemented as `Nan::PersistentBase` for older versions of V8 and the native `v8::PersistentBase` is used for newer versions of V8)_ + +```c++ +template class PersistentBase { + public: + /** + * If non-empty, destroy the underlying storage cell + */ + void Reset(); + + /** + * If non-empty, destroy the underlying storage cell and create a new one with + * the contents of another if it is also non-empty + */ + template void Reset(const v8::Local &other); + + /** + * If non-empty, destroy the underlying storage cell and create a new one with + * the contents of another if it is also non-empty + */ + template void Reset(const PersistentBase &other); + + /** Returns true if the handle is empty. */ + bool IsEmpty() const; + + /** + * If non-empty, destroy the underlying storage cell + * IsEmpty() will return true after this call. + */ + void Empty(); + + template bool operator==(const PersistentBase &that); + + template bool operator==(const v8::Local &that); + + template bool operator!=(const PersistentBase &that); + + template bool operator!=(const v8::Local &that); + + /** + * Install a finalization callback on this object. + * NOTE: There is no guarantee as to *when* or even *if* the callback is + * invoked. The invocation is performed solely on a best effort basis. + * As always, GC-based finalization should *not* be relied upon for any + * critical form of resource management! At the moment you can either + * specify a parameter for the callback or the location of two internal + * fields in the dying object. + */ + template + void SetWeak(P *parameter, + typename WeakCallbackInfo

::Callback callback, + WeakCallbackType type); + + void ClearWeak(); + + /** + * Marks the reference to this object independent. Garbage collector is free + * to ignore any object groups containing this object. Weak callback for an + * independent handle should not assume that it will be preceded by a global + * GC prologue callback or followed by a global GC epilogue callback. + */ + void MarkIndependent() const; + + bool IsIndependent() const; + + /** Checks if the handle holds the only reference to an object. */ + bool IsNearDeath() const; + + /** Returns true if the handle's reference is weak. */ + bool IsWeak() const +}; +``` + +See the V8 documentation for [`PersistentBase`](https://v8docs.nodesource.com/node-8.16/d4/dca/classv8_1_1_persistent_base.html) for further information. + +**Tip:** To get a `v8::Local` reference to the original object back from a `PersistentBase` or `Persistent` object: + +```c++ +v8::Local object = Nan::New(persistent); +``` + + +### Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits + +Default traits for `Nan::Persistent`. This class does not allow use of the a copy constructor or assignment operator. At present `kResetInDestructor` is not set, but that will change in a future version. + +Definition: + +_(note: this is implemented as `Nan::NonCopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ + +```c++ +template class NonCopyablePersistentTraits { + public: + typedef Persistent > NonCopyablePersistent; + + static const bool kResetInDestructor = false; + + template + static void Copy(const Persistent &source, + NonCopyablePersistent *dest); + + template static void Uncompilable(); +}; +``` + +See the V8 documentation for [`NonCopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/de/d73/classv8_1_1_non_copyable_persistent_traits.html) for further information. + + +### Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits + +A helper class of traits to allow copying and assignment of `Persistent`. This will clone the contents of storage cell, but not any of the flags, etc.. + +Definition: + +_(note: this is implemented as `Nan::CopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ + +```c++ +template +class CopyablePersistentTraits { + public: + typedef Persistent > CopyablePersistent; + + static const bool kResetInDestructor = true; + + template + static void Copy(const Persistent &source, + CopyablePersistent *dest); +}; +``` + +See the V8 documentation for [`CopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.16/da/d5c/structv8_1_1_copyable_persistent_traits.html) for further information. + + +### Nan::Persistent + +A type of `PersistentBase` which allows copy and assignment. Copy, assignment and destructor behavior is controlled by the traits class `M`. + +Definition: + +```c++ +template > +class Persistent; + +template class Persistent : public PersistentBase { + public: + /** + * A Persistent with no storage cell. + */ + Persistent(); + + /** + * Construct a Persistent from a v8::Local. When the v8::Local is non-empty, a + * new storage cell is created pointing to the same object, and no flags are + * set. + */ + template Persistent(v8::Local that); + + /** + * Construct a Persistent from a Persistent. When the Persistent is non-empty, + * a new storage cell is created pointing to the same object, and no flags are + * set. + */ + Persistent(const Persistent &that); + + /** + * The copy constructors and assignment operator create a Persistent exactly + * as the Persistent constructor, but the Copy function from the traits class + * is called, allowing the setting of flags based on the copied Persistent. + */ + Persistent &operator=(const Persistent &that); + + template + Persistent &operator=(const Persistent &that); + + /** + * The destructor will dispose the Persistent based on the kResetInDestructor + * flags in the traits class. Since not calling dispose can result in a + * memory leak, it is recommended to always set this flag. + */ + ~Persistent(); +}; +``` + +See the V8 documentation for [`Persistent`](https://v8docs.nodesource.com/node-8.16/d2/d78/classv8_1_1_persistent.html) for further information. + + +### Nan::Global + +A type of `PersistentBase` which has move semantics. + +```c++ +template class Global : public PersistentBase { + public: + /** + * A Global with no storage cell. + */ + Global(); + + /** + * Construct a Global from a v8::Local. When the v8::Local is non-empty, a new + * storage cell is created pointing to the same object, and no flags are set. + */ + template Global(v8::Local that); + /** + * Construct a Global from a PersistentBase. When the Persistent is non-empty, + * a new storage cell is created pointing to the same object, and no flags are + * set. + */ + template Global(const PersistentBase &that); + + /** + * Pass allows returning globals from functions, etc. + */ + Global Pass(); +}; +``` + +See the V8 documentation for [`Global`](https://v8docs.nodesource.com/node-8.16/d5/d40/classv8_1_1_global.html) for further information. + + +### Nan::WeakCallbackInfo + +`Nan::WeakCallbackInfo` is used as an argument when setting a persistent reference as weak. You may need to free any external resources attached to the object. It is a mirror of `v8:WeakCallbackInfo` as found in newer versions of V8. + +Definition: + +```c++ +template class WeakCallbackInfo { + public: + typedef void (*Callback)(const WeakCallbackInfo& data); + + v8::Isolate *GetIsolate() const; + + /** + * Get the parameter that was associated with the weak handle. + */ + T *GetParameter() const; + + /** + * Get pointer from internal field, index can be 0 or 1. + */ + void *GetInternalField(int index) const; +}; +``` + +Example usage: + +```c++ +void weakCallback(const WeakCallbackInfo &data) { + int *parameter = data.GetParameter(); + delete parameter; +} + +Persistent obj; +int *data = new int(0); +obj.SetWeak(data, callback, WeakCallbackType::kParameter); +``` + +See the V8 documentation for [`WeakCallbackInfo`](https://v8docs.nodesource.com/node-8.16/d8/d06/classv8_1_1_weak_callback_info.html) for further information. + + +### Nan::WeakCallbackType + +Represents the type of a weak callback. +A weak callback of type `kParameter` makes the supplied parameter to `Nan::PersistentBase::SetWeak` available through `WeakCallbackInfo::GetParameter`. +A weak callback of type `kInternalFields` uses up to two internal fields at indices 0 and 1 on the `Nan::PersistentBase` being made weak. +Note that only `v8::Object`s and derivatives can have internal fields. + +Definition: + +```c++ +enum class WeakCallbackType { kParameter, kInternalFields }; +``` diff --git a/node_modules/nan/doc/scopes.md b/node_modules/nan/doc/scopes.md new file mode 100644 index 00000000..84000eeb --- /dev/null +++ b/node_modules/nan/doc/scopes.md @@ -0,0 +1,73 @@ +## Scopes + +A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. + +A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. + +The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. + + - Nan::HandleScope + - Nan::EscapableHandleScope + +Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). + + +### Nan::HandleScope + +A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/node-8.16/d3/d95/classv8_1_1_handle_scope.html). + +Definition: + +```c++ +class Nan::HandleScope { + public: + Nan::HandleScope(); + static int NumberOfHandles(); +}; +``` + +Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself. + +Example: + +```c++ +// new object is created, it needs a new scope: +void Pointless() { + Nan::HandleScope scope; + v8::Local obj = Nan::New(); +} + +// JavaScript-accessible method already has a HandleScope +NAN_METHOD(Pointless2) { + v8::Local obj = Nan::New(); +} +``` + + +### Nan::EscapableHandleScope + +Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it. + +Definition: + +```c++ +class Nan::EscapableHandleScope { + public: + Nan::EscapableHandleScope(); + static int NumberOfHandles(); + template v8::Local Escape(v8::Local value); +} +``` + +Use `Escape(value)` to return the object. + +Example: + +```c++ +v8::Local EmptyObj() { + Nan::EscapableHandleScope scope; + v8::Local obj = Nan::New(); + return scope.Escape(obj); +} +``` + diff --git a/node_modules/nan/doc/script.md b/node_modules/nan/doc/script.md new file mode 100644 index 00000000..213320ad --- /dev/null +++ b/node_modules/nan/doc/script.md @@ -0,0 +1,38 @@ +## Script + +NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. + + - Nan::CompileScript() + - Nan::RunScript() + + + +### Nan::CompileScript() + +A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.16/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b). + +Note that `Nan::BoundScript` is an alias for `v8::Script`. + +Signature: + +```c++ +Nan::MaybeLocal Nan::CompileScript( + v8::Local s, + const v8::ScriptOrigin& origin); +Nan::MaybeLocal Nan::CompileScript(v8::Local s); +``` + + + +### Nan::RunScript() + +Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`. + +Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8. + +Signature: + +```c++ +Nan::MaybeLocal Nan::RunScript(v8::Local script) +Nan::MaybeLocal Nan::RunScript(v8::Local script) +``` diff --git a/node_modules/nan/doc/string_bytes.md b/node_modules/nan/doc/string_bytes.md new file mode 100644 index 00000000..7c1bd325 --- /dev/null +++ b/node_modules/nan/doc/string_bytes.md @@ -0,0 +1,62 @@ +## Strings & Bytes + +Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. + + - Nan::Encoding + - Nan::Encode() + - Nan::DecodeBytes() + - Nan::DecodeWrite() + + + +### Nan::Encoding + +An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node. + +Definition: + +```c++ +enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER } +``` + + + +### Nan::Encode() + +A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node. + +Signature: + +```c++ +v8::Local Nan::Encode(const void *buf, + size_t len, + enum Nan::Encoding encoding = BINARY); +``` + + + +### Nan::DecodeBytes() + +A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node. + +Signature: + +```c++ +ssize_t Nan::DecodeBytes(v8::Local val, + enum Nan::Encoding encoding = BINARY); +``` + + + +### Nan::DecodeWrite() + +A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node. + +Signature: + +```c++ +ssize_t Nan::DecodeWrite(char *buf, + size_t len, + v8::Local val, + enum Nan::Encoding encoding = BINARY); +``` diff --git a/node_modules/nan/doc/v8_internals.md b/node_modules/nan/doc/v8_internals.md new file mode 100644 index 00000000..08dd6d04 --- /dev/null +++ b/node_modules/nan/doc/v8_internals.md @@ -0,0 +1,199 @@ +## V8 internals + +The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. + + - NAN_GC_CALLBACK() + - Nan::AddGCEpilogueCallback() + - Nan::RemoveGCEpilogueCallback() + - Nan::AddGCPrologueCallback() + - Nan::RemoveGCPrologueCallback() + - Nan::GetHeapStatistics() + - Nan::SetCounterFunction() + - Nan::SetCreateHistogramFunction() + - Nan::SetAddHistogramSampleFunction() + - Nan::IdleNotification() + - Nan::LowMemoryNotification() + - Nan::ContextDisposedNotification() + - Nan::GetInternalFieldPointer() + - Nan::SetInternalFieldPointer() + - Nan::AdjustExternalMemory() + + + +### NAN_GC_CALLBACK(callbackname) + +Use `NAN_GC_CALLBACK` to declare your callbacks for `Nan::AddGCPrologueCallback()` and `Nan::AddGCEpilogueCallback()`. Your new method receives the arguments `v8::GCType type` and `v8::GCCallbackFlags flags`. + +```c++ +static Nan::Persistent callback; + +NAN_GC_CALLBACK(gcPrologueCallback) { + v8::Local argv[] = { Nan::New("prologue").ToLocalChecked() }; + Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(callback), 1, argv); +} + +NAN_METHOD(Hook) { + callback.Reset(To(args[0]).ToLocalChecked()); + Nan::AddGCPrologueCallback(gcPrologueCallback); + info.GetReturnValue().Set(info.Holder()); +} +``` + + +### Nan::AddGCEpilogueCallback() + +Signature: + +```c++ +void Nan::AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, v8::GCType gc_type_filter = v8::kGCTypeAll) +``` + +Calls V8's [`AddGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a580f976e4290cead62c2fc4dd396be3e). + + +### Nan::RemoveGCEpilogueCallback() + +Signature: + +```c++ +void Nan::RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback) +``` + +Calls V8's [`RemoveGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#adca9294555a3908e9f23c7bb0f0f284c). + + +### Nan::AddGCPrologueCallback() + +Signature: + +```c++ +void Nan::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback, v8::GCType gc_type_filter callback) +``` + +Calls V8's [`AddGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a6dbef303603ebdb03da6998794ea05b8). + + +### Nan::RemoveGCPrologueCallback() + +Signature: + +```c++ +void Nan::RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback) +``` + +Calls V8's [`RemoveGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5f72c7cda21415ce062bbe5c58abe09e). + + +### Nan::GetHeapStatistics() + +Signature: + +```c++ +void Nan::GetHeapStatistics(v8::HeapStatistics *heap_statistics) +``` + +Calls V8's [`GetHeapStatistics()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5593ac74687b713095c38987e5950b34). + + +### Nan::SetCounterFunction() + +Signature: + +```c++ +void Nan::SetCounterFunction(v8::CounterLookupCallback cb) +``` + +Calls V8's [`SetCounterFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a045d7754e62fa0ec72ae6c259b29af94). + + +### Nan::SetCreateHistogramFunction() + +Signature: + +```c++ +void Nan::SetCreateHistogramFunction(v8::CreateHistogramCallback cb) +``` + +Calls V8's [`SetCreateHistogramFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a542d67e85089cb3f92aadf032f99e732). + + +### Nan::SetAddHistogramSampleFunction() + +Signature: + +```c++ +void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) +``` + +Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea). + + +### Nan::IdleNotification() + +Signature: + +```c++ +bool Nan::IdleNotification(int idle_time_in_ms) +``` + +Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version. + + +### Nan::LowMemoryNotification() + +Signature: + +```c++ +void Nan::LowMemoryNotification() +``` + +Calls V8's [`LowMemoryNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a24647f61d6b41f69668094bdcd6ea91f). + + +### Nan::ContextDisposedNotification() + +Signature: + +```c++ +void Nan::ContextDisposedNotification() +``` + +Calls V8's [`ContextDisposedNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad7f5dc559866343fe6cd8db1f134d48b). + + +### Nan::GetInternalFieldPointer() + +Gets a pointer to the internal field with at `index` from a V8 `Object` handle. + +Signature: + +```c++ +void* Nan::GetInternalFieldPointer(v8::Local object, int index) +``` + +Calls the Object's [`GetAlignedPointerFromInternalField()` or `GetPointerFromInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a580ea84afb26c005d6762eeb9e3c308f) depending on the version of V8. + + +### Nan::SetInternalFieldPointer() + +Sets the value of the internal field at `index` on a V8 `Object` handle. + +Signature: + +```c++ +void Nan::SetInternalFieldPointer(v8::Local object, int index, void* value) +``` + +Calls the Object's [`SetAlignedPointerInInternalField()` or `SetPointerInInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c57184263cf29963ef0017bec82281) depending on the version of V8. + + +### Nan::AdjustExternalMemory() + +Signature: + +```c++ +int Nan::AdjustExternalMemory(int bytesChange) +``` + +Calls V8's [`AdjustAmountOfExternalAllocatedMemory()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ae1a59cac60409d3922582c4af675473e). + diff --git a/node_modules/nan/doc/v8_misc.md b/node_modules/nan/doc/v8_misc.md new file mode 100644 index 00000000..1bd46d35 --- /dev/null +++ b/node_modules/nan/doc/v8_misc.md @@ -0,0 +1,85 @@ +## Miscellaneous V8 Helpers + + - Nan::Utf8String + - Nan::GetCurrentContext() + - Nan::SetIsolateData() + - Nan::GetIsolateData() + - Nan::TypedArrayContents + + + +### Nan::Utf8String + +Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object. + +An implementation of [`v8::String::Utf8Value`](https://v8docs.nodesource.com/node-8.16/d4/d1b/classv8_1_1_string_1_1_utf8_value.html) that is consistent across all supported versions of V8. + +Definition: + +```c++ +class Nan::Utf8String { + public: + Nan::Utf8String(v8::Local from); + + int length() const; + + char* operator*(); + const char* operator*() const; +}; +``` + + +### Nan::GetCurrentContext() + +A call to [`v8::Isolate::GetCurrent()->GetCurrentContext()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a81c7a1ed7001ae2a65e89107f75fd053) that works across all supported versions of V8. + +Signature: + +```c++ +v8::Local Nan::GetCurrentContext() +``` + + +### Nan::SetIsolateData() + +A helper to provide a consistent API to [`v8::Isolate#SetData()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a7acadfe7965997e9c386a05f098fbe36). + +Signature: + +```c++ +void Nan::SetIsolateData(v8::Isolate *isolate, T *data) +``` + + + +### Nan::GetIsolateData() + +A helper to provide a consistent API to [`v8::Isolate#GetData()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aabd223436bc1100a787dadaa024c6257). + +Signature: + +```c++ +T *Nan::GetIsolateData(v8::Isolate *isolate) +``` + + +### Nan::TypedArrayContents + +A helper class for accessing the contents of an ArrayBufferView (aka a typedarray) from C++. If the input array is not a valid typedarray, then the data pointer of TypedArrayContents will default to `NULL` and the length will be 0. If the data pointer is not compatible with the alignment requirements of type, an assertion error will fail. + +Note that you must store a reference to the `array` object while you are accessing its contents. + +Definition: + +```c++ +template +class Nan::TypedArrayContents { + public: + TypedArrayContents(v8::Local array); + + size_t length() const; + + T* const operator*(); + const T* const operator*() const; +}; +``` diff --git a/node_modules/nan/include_dirs.js b/node_modules/nan/include_dirs.js new file mode 100644 index 00000000..4f1dfb41 --- /dev/null +++ b/node_modules/nan/include_dirs.js @@ -0,0 +1 @@ +console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/nan/nan.h b/node_modules/nan/nan.h new file mode 100644 index 00000000..648e6e26 --- /dev/null +++ b/node_modules/nan/nan.h @@ -0,0 +1,2891 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors: + * - Rod Vagg + * - Benjamin Byholm + * - Trevor Norris + * - Nathan Rajlich + * - Brett Lawson + * - Ben Noordhuis + * - David Siegel + * - Michael Ira Krufky + * + * MIT License + * + * Version 2.14.1: current Node 14.0.0, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1 + * + * See https://github.com/nodejs/nan for the latest update to this file + **********************************************************************************/ + +#ifndef NAN_H_ +#define NAN_H_ + +#include + +#define NODE_0_10_MODULE_VERSION 11 +#define NODE_0_12_MODULE_VERSION 14 +#define ATOM_0_21_MODULE_VERSION 41 +#define IOJS_1_0_MODULE_VERSION 42 +#define IOJS_1_1_MODULE_VERSION 43 +#define IOJS_2_0_MODULE_VERSION 44 +#define IOJS_3_0_MODULE_VERSION 45 +#define NODE_4_0_MODULE_VERSION 46 +#define NODE_5_0_MODULE_VERSION 47 +#define NODE_6_0_MODULE_VERSION 48 +#define NODE_7_0_MODULE_VERSION 51 +#define NODE_8_0_MODULE_VERSION 57 +#define NODE_9_0_MODULE_VERSION 59 +#define NODE_10_0_MODULE_VERSION 64 +#define NODE_11_0_MODULE_VERSION 67 +#define NODE_12_0_MODULE_VERSION 72 +#define NODE_13_0_MODULE_VERSION 79 +#define NODE_14_0_MODULE_VERSION 83 + +#ifdef _MSC_VER +# define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800) +#else +# define NAN_HAS_CPLUSPLUS_11 (__cplusplus >= 201103L) +#endif + +#if NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION && !NAN_HAS_CPLUSPLUS_11 +# error This version of node/NAN/v8 requires a C++11 compiler +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(_MSC_VER) +# pragma warning( push ) +# pragma warning( disable : 4530 ) +# include +# include +# include +# pragma warning( pop ) +#else +# include +# include +# include +#endif + +// uv helpers +#ifdef UV_VERSION_MAJOR +# ifndef UV_VERSION_PATCH +# define UV_VERSION_PATCH 0 +# endif +# define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ + (UV_VERSION_MINOR << 8) | \ + (UV_VERSION_PATCH)) +#else +# define NAUV_UVVERSION 0x000b00 +#endif + +#if NAUV_UVVERSION < 0x000b0b +# ifdef WIN32 +# include +# else +# include +# endif +#endif + +namespace Nan { + +#define NAN_CONCAT(a, b) NAN_CONCAT_HELPER(a, b) +#define NAN_CONCAT_HELPER(a, b) a##b + +#define NAN_INLINE inline // TODO(bnoordhuis) Remove in v3.0.0. + +#if defined(__GNUC__) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) && \ + !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) +# define NAN_DEPRECATED __declspec(deprecated) +#else +# define NAN_DEPRECATED +#endif + +#if NAN_HAS_CPLUSPLUS_11 +# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&) = delete; +# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&) = delete; +# define NAN_DISALLOW_MOVE(CLASS) \ + CLASS(CLASS&&) = delete; /* NOLINT(build/c++11) */ \ + void operator=(CLASS&&) = delete; +#else +# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&); +# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&); +# define NAN_DISALLOW_MOVE(CLASS) +#endif + +#define NAN_DISALLOW_ASSIGN_COPY(CLASS) \ + NAN_DISALLOW_ASSIGN(CLASS) \ + NAN_DISALLOW_COPY(CLASS) + +#define NAN_DISALLOW_ASSIGN_MOVE(CLASS) \ + NAN_DISALLOW_ASSIGN(CLASS) \ + NAN_DISALLOW_MOVE(CLASS) + +#define NAN_DISALLOW_COPY_MOVE(CLASS) \ + NAN_DISALLOW_COPY(CLASS) \ + NAN_DISALLOW_MOVE(CLASS) + +#define NAN_DISALLOW_ASSIGN_COPY_MOVE(CLASS) \ + NAN_DISALLOW_ASSIGN(CLASS) \ + NAN_DISALLOW_COPY(CLASS) \ + NAN_DISALLOW_MOVE(CLASS) + +#define TYPE_CHECK(T, S) \ + while (false) { \ + *(static_cast(0)) = static_cast(0); \ + } + +//=== RegistrationFunction ===================================================== + +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + typedef v8::Handle ADDON_REGISTER_FUNCTION_ARGS_TYPE; +#else + typedef v8::Local ADDON_REGISTER_FUNCTION_ARGS_TYPE; +#endif + +#define NAN_MODULE_INIT(name) \ + void name(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) + +#if NODE_MAJOR_VERSION >= 10 || \ + NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 +#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ + extern "C" NODE_MODULE_EXPORT void \ + NAN_CONCAT(node_register_module_v, NODE_MODULE_VERSION)( \ + v8::Local exports, v8::Local module, \ + v8::Local context) \ + { \ + registration(exports); \ + } +#else +#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ + NODE_MODULE(module_name, registration) +#endif + +//=== CallbackInfo ============================================================= + +#include "nan_callbacks.h" // NOLINT(build/include) + +//============================================================================== + +#if (NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION) +typedef v8::Script UnboundScript; +typedef v8::Script BoundScript; +#else +typedef v8::UnboundScript UnboundScript; +typedef v8::Script BoundScript; +#endif + +#if (NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION) +typedef v8::String::ExternalAsciiStringResource + ExternalOneByteStringResource; +#else +typedef v8::String::ExternalOneByteStringResource + ExternalOneByteStringResource; +#endif + +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) +template +class NonCopyablePersistentTraits : + public v8::NonCopyablePersistentTraits {}; +template +class CopyablePersistentTraits : + public v8::CopyablePersistentTraits {}; + +template +class PersistentBase : + public v8::PersistentBase {}; + +template > +class Persistent; +#else +template class NonCopyablePersistentTraits; +template class PersistentBase; +template class WeakCallbackData; +template > +class Persistent; +#endif // NODE_MODULE_VERSION + +template +class Maybe { + public: + inline bool IsNothing() const { return !has_value_; } + inline bool IsJust() const { return has_value_; } + + inline T ToChecked() const { return FromJust(); } + inline void Check() const { FromJust(); } + + inline bool To(T* out) const { + if (IsJust()) *out = value_; + return IsJust(); + } + + inline T FromJust() const { +#if defined(V8_ENABLE_CHECKS) + assert(IsJust() && "FromJust is Nothing"); +#endif // V8_ENABLE_CHECKS + return value_; + } + + inline T FromMaybe(const T& default_value) const { + return has_value_ ? value_ : default_value; + } + + inline bool operator==(const Maybe &other) const { + return (IsJust() == other.IsJust()) && + (!IsJust() || FromJust() == other.FromJust()); + } + + inline bool operator!=(const Maybe &other) const { + return !operator==(other); + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + // Allow implicit conversions from v8::Maybe to Nan::Maybe. + Maybe(const v8::Maybe& that) // NOLINT(runtime/explicit) + : has_value_(that.IsJust()) + , value_(that.FromMaybe(T())) {} +#endif + + private: + Maybe() : has_value_(false) {} + explicit Maybe(const T& t) : has_value_(true), value_(t) {} + bool has_value_; + T value_; + + template + friend Maybe Nothing(); + template + friend Maybe Just(const U& u); +}; + +template +inline Maybe Nothing() { + return Maybe(); +} + +template +inline Maybe Just(const T& t) { + return Maybe(t); +} + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +# include "nan_maybe_43_inl.h" // NOLINT(build/include) +#else +# include "nan_maybe_pre_43_inl.h" // NOLINT(build/include) +#endif + +#include "nan_converters.h" // NOLINT(build/include) +#include "nan_new.h" // NOLINT(build/include) + +#if NAUV_UVVERSION < 0x000b17 +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async, int) +#else +#define NAUV_WORK_CB(func) \ + void func(uv_async_t *async) +#endif + +#if NAUV_UVVERSION >= 0x000b0b + +typedef uv_key_t nauv_key_t; + +inline int nauv_key_create(nauv_key_t *key) { + return uv_key_create(key); +} + +inline void nauv_key_delete(nauv_key_t *key) { + uv_key_delete(key); +} + +inline void* nauv_key_get(nauv_key_t *key) { + return uv_key_get(key); +} + +inline void nauv_key_set(nauv_key_t *key, void *value) { + uv_key_set(key, value); +} + +#else + +/* Implement thread local storage for older versions of libuv. + * This is essentially a backport of libuv commit 5d2434bf + * written by Ben Noordhuis, adjusted for names and inline. + */ + +#ifndef WIN32 + +typedef pthread_key_t nauv_key_t; + +inline int nauv_key_create(nauv_key_t* key) { + return -pthread_key_create(key, NULL); +} + +inline void nauv_key_delete(nauv_key_t* key) { + if (pthread_key_delete(*key)) + abort(); +} + +inline void* nauv_key_get(nauv_key_t* key) { + return pthread_getspecific(*key); +} + +inline void nauv_key_set(nauv_key_t* key, void* value) { + if (pthread_setspecific(*key, value)) + abort(); +} + +#else + +typedef struct { + DWORD tls_index; +} nauv_key_t; + +inline int nauv_key_create(nauv_key_t* key) { + key->tls_index = TlsAlloc(); + if (key->tls_index == TLS_OUT_OF_INDEXES) + return UV_ENOMEM; + return 0; +} + +inline void nauv_key_delete(nauv_key_t* key) { + if (TlsFree(key->tls_index) == FALSE) + abort(); + key->tls_index = TLS_OUT_OF_INDEXES; +} + +inline void* nauv_key_get(nauv_key_t* key) { + void* value = TlsGetValue(key->tls_index); + if (value == NULL) + if (GetLastError() != ERROR_SUCCESS) + abort(); + return value; +} + +inline void nauv_key_set(nauv_key_t* key, void* value) { + if (TlsSetValue(key->tls_index, value) == FALSE) + abort(); +} + +#endif +#endif + +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION +template +v8::Local New(v8::Handle); +#endif + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + typedef v8::WeakCallbackType WeakCallbackType; +#else +struct WeakCallbackType { + enum E {kParameter, kInternalFields}; + E type; + WeakCallbackType(E other) : type(other) {} // NOLINT(runtime/explicit) + inline bool operator==(E other) { return other == this->type; } + inline bool operator!=(E other) { return !operator==(other); } +}; +#endif + +template class WeakCallbackInfo; + +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +# include "nan_persistent_12_inl.h" // NOLINT(build/include) +#else +# include "nan_persistent_pre_12_inl.h" // NOLINT(build/include) +#endif + +namespace imp { + static const size_t kMaxLength = 0x3fffffff; + // v8::String::REPLACE_INVALID_UTF8 was introduced + // in node.js v0.10.29 and v0.8.27. +#if NODE_MAJOR_VERSION > 0 || \ + NODE_MINOR_VERSION > 10 || \ + NODE_MINOR_VERSION == 10 && NODE_PATCH_VERSION >= 29 || \ + NODE_MINOR_VERSION == 8 && NODE_PATCH_VERSION >= 27 + static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; +#else + static const unsigned kReplaceInvalidUtf8 = 0; +#endif +} // end of namespace imp + +//=== HandleScope ============================================================== + +class HandleScope { + v8::HandleScope scope; + + public: +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + inline HandleScope() : scope(v8::Isolate::GetCurrent()) {} + inline static int NumberOfHandles() { + return v8::HandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); + } +#else + inline HandleScope() : scope() {} + inline static int NumberOfHandles() { + return v8::HandleScope::NumberOfHandles(); + } +#endif + + private: + // Make it hard to create heap-allocated or illegal handle scopes by + // disallowing certain operations. + HandleScope(const HandleScope &); + void operator=(const HandleScope &); + void *operator new(size_t size); + void operator delete(void *, size_t) { + abort(); + } +}; + +class EscapableHandleScope { + public: +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + inline EscapableHandleScope() : scope(v8::Isolate::GetCurrent()) {} + + inline static int NumberOfHandles() { + return v8::EscapableHandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); + } + + template + inline v8::Local Escape(v8::Local value) { + return scope.Escape(value); + } + + private: + v8::EscapableHandleScope scope; +#else + inline EscapableHandleScope() : scope() {} + + inline static int NumberOfHandles() { + return v8::HandleScope::NumberOfHandles(); + } + + template + inline v8::Local Escape(v8::Local value) { + return scope.Close(value); + } + + private: + v8::HandleScope scope; +#endif + + private: + // Make it hard to create heap-allocated or illegal handle scopes by + // disallowing certain operations. + EscapableHandleScope(const EscapableHandleScope &); + void operator=(const EscapableHandleScope &); + void *operator new(size_t size); + void operator delete(void *, size_t) { + abort(); + } +}; + +//=== TryCatch ================================================================= + +class TryCatch { + v8::TryCatch try_catch_; + friend void FatalException(const TryCatch&); + + public: +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION + TryCatch() : try_catch_(v8::Isolate::GetCurrent()) {} +#endif + + inline bool HasCaught() const { return try_catch_.HasCaught(); } + + inline bool CanContinue() const { return try_catch_.CanContinue(); } + + inline v8::Local ReThrow() { +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + return New(try_catch_.ReThrow()); +#else + return try_catch_.ReThrow(); +#endif + } + + inline v8::Local Exception() const { + return try_catch_.Exception(); + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + inline v8::MaybeLocal StackTrace() const { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(try_catch_.StackTrace(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); + } +#else + inline MaybeLocal StackTrace() const { + return try_catch_.StackTrace(); + } +#endif + + inline v8::Local Message() const { + return try_catch_.Message(); + } + + inline void Reset() { try_catch_.Reset(); } + + inline void SetVerbose(bool value) { try_catch_.SetVerbose(value); } + + inline void SetCaptureMessage(bool value) { + try_catch_.SetCaptureMessage(value); + } +}; + +v8::Local MakeCallback(v8::Local target, + v8::Local func, + int argc, + v8::Local* argv); +v8::Local MakeCallback(v8::Local target, + v8::Local symbol, + int argc, + v8::Local* argv); +v8::Local MakeCallback(v8::Local target, + const char* method, + int argc, + v8::Local* argv); + +// === AsyncResource =========================================================== + +class AsyncResource { + public: + AsyncResource( + v8::Local name + , v8::Local resource = New()) { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + + if (resource.IsEmpty()) { + resource = New(); + } + + context = node::EmitAsyncInit(isolate, resource, name); +#endif + } + + AsyncResource( + const char* name + , v8::Local resource = New()) { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + + if (resource.IsEmpty()) { + resource = New(); + } + + v8::Local name_string = + New(name).ToLocalChecked(); + context = node::EmitAsyncInit(isolate, resource, name_string); +#endif + } + + ~AsyncResource() { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + node::EmitAsyncDestroy(isolate, context); +#endif + } + + inline MaybeLocal runInAsyncScope( + v8::Local target + , v8::Local func + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION + return MakeCallback(target, func, argc, argv); +#else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv, context); +#endif + } + + inline MaybeLocal runInAsyncScope( + v8::Local target + , v8::Local symbol + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION + return MakeCallback(target, symbol, argc, argv); +#else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv, context); +#endif + } + + inline MaybeLocal runInAsyncScope( + v8::Local target + , const char* method + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION + return MakeCallback(target, method, argc, argv); +#else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv, context); +#endif + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncResource) +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + node::async_context context; +#endif +}; + +inline uv_loop_t* GetCurrentEventLoop() { +#if NODE_MAJOR_VERSION >= 10 || \ + NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 || \ + NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION >= 10 + return node::GetCurrentEventLoop(v8::Isolate::GetCurrent()); +#else + return uv_default_loop(); +#endif +} + +//============ ================================================================= + +/* node 0.12 */ +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION + inline + void SetCounterFunction(v8::CounterLookupCallback cb) { + v8::Isolate::GetCurrent()->SetCounterFunction(cb); + } + + inline + void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); + } + + inline + void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + inline bool IdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotificationDeadline( + idle_time_in_ms * 0.001); + } +# else + inline bool IdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); + } +#endif + + inline void LowMemoryNotification() { + v8::Isolate::GetCurrent()->LowMemoryNotification(); + } + + inline void ContextDisposedNotification() { + v8::Isolate::GetCurrent()->ContextDisposedNotification(); + } +#else + inline + void SetCounterFunction(v8::CounterLookupCallback cb) { + v8::V8::SetCounterFunction(cb); + } + + inline + void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::V8::SetCreateHistogramFunction(cb); + } + + inline + void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::V8::SetAddHistogramSampleFunction(cb); + } + + inline bool IdleNotification(int idle_time_in_ms) { + return v8::V8::IdleNotification(idle_time_in_ms); + } + + inline void LowMemoryNotification() { + v8::V8::LowMemoryNotification(); + } + + inline void ContextDisposedNotification() { + v8::V8::ContextDisposedNotification(); + } +#endif + +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) // Node 0.12 + inline v8::Local Undefined() { +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(v8::Undefined(v8::Isolate::GetCurrent()))); +# else + return v8::Undefined(v8::Isolate::GetCurrent()); +# endif + } + + inline v8::Local Null() { +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(v8::Null(v8::Isolate::GetCurrent()))); +# else + return v8::Null(v8::Isolate::GetCurrent()); +# endif + } + + inline v8::Local True() { +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(v8::True(v8::Isolate::GetCurrent()))); +# else + return v8::True(v8::Isolate::GetCurrent()); +# endif + } + + inline v8::Local False() { +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(v8::False(v8::Isolate::GetCurrent()))); +# else + return v8::False(v8::Isolate::GetCurrent()); +# endif + } + + inline v8::Local EmptyString() { + return v8::String::Empty(v8::Isolate::GetCurrent()); + } + + inline int AdjustExternalMemory(int bc) { + return static_cast( + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); + } + + inline void SetTemplate( + v8::Local templ + , const char *name + , v8::Local value) { + templ->Set(v8::Isolate::GetCurrent(), name, value); + } + + inline void SetTemplate( + v8::Local templ + , v8::Local name + , v8::Local value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + inline v8::Local GetCurrentContext() { + return v8::Isolate::GetCurrent()->GetCurrentContext(); + } + + inline void* GetInternalFieldPointer( + v8::Local object + , int index) { + return object->GetAlignedPointerFromInternalField(index); + } + + inline void SetInternalFieldPointer( + v8::Local object + , int index + , void* value) { + object->SetAlignedPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) + +#if NODE_MODULE_VERSION <= NODE_4_0_MODULE_VERSION + typedef v8::Isolate::GCEpilogueCallback GCEpilogueCallback; + typedef v8::Isolate::GCPrologueCallback GCPrologueCallback; +#else + typedef v8::Isolate::GCCallback GCEpilogueCallback; + typedef v8::Isolate::GCCallback GCPrologueCallback; +#endif + + inline void AddGCEpilogueCallback( + GCEpilogueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); + } + + inline void RemoveGCEpilogueCallback( + GCEpilogueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); + } + + inline void AddGCPrologueCallback( + GCPrologueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); + } + + inline void RemoveGCPrologueCallback( + GCPrologueCallback callback) { + v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); + } + + inline void GetHeapStatistics( + v8::HeapStatistics *heap_statistics) { + v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); + } + +# define X(NAME) \ + inline v8::Local NAME(const char *msg) { \ + EscapableHandleScope scope; \ + return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ + } \ + \ + inline \ + v8::Local NAME(v8::Local msg) { \ + return v8::Exception::NAME(msg); \ + } \ + \ + inline void Throw ## NAME(const char *msg) { \ + HandleScope scope; \ + v8::Isolate::GetCurrent()->ThrowException( \ + v8::Exception::NAME(New(msg).ToLocalChecked())); \ + } \ + \ + inline void Throw ## NAME(v8::Local msg) { \ + HandleScope scope; \ + v8::Isolate::GetCurrent()->ThrowException( \ + v8::Exception::NAME(msg)); \ + } + + X(Error) + X(RangeError) + X(ReferenceError) + X(SyntaxError) + X(TypeError) + +# undef X + + inline void ThrowError(v8::Local error) { + v8::Isolate::GetCurrent()->ThrowException(error); + } + + inline MaybeLocal NewBuffer( + char *data + , size_t length +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + , node::Buffer::FreeCallback callback +#else + , node::smalloc::FreeCallback callback +#endif + , void *hint + ) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(length <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + return node::Buffer::New( + v8::Isolate::GetCurrent(), data, length, callback, hint); +#else + return node::Buffer::New(v8::Isolate::GetCurrent(), data, length, callback, + hint); +#endif + } + + inline MaybeLocal CopyBuffer( + const char *data + , uint32_t size + ) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + return node::Buffer::Copy( + v8::Isolate::GetCurrent(), data, size); +#else + return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); +#endif + } + + inline MaybeLocal NewBuffer(uint32_t size) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + return node::Buffer::New( + v8::Isolate::GetCurrent(), size); +#else + return node::Buffer::New(v8::Isolate::GetCurrent(), size); +#endif + } + + inline MaybeLocal NewBuffer( + char* data + , uint32_t size + ) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION + return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); +#else + return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); +#endif + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + inline MaybeLocal + NewOneByteString(const uint8_t * value, int length = -1) { + return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, + v8::NewStringType::kNormal, length); + } + + inline MaybeLocal CompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::ScriptCompiler::Source source(s, origin); + return scope.Escape( + v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) + .FromMaybe(v8::Local())); + } + + inline MaybeLocal CompileScript( + v8::Local s + ) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::ScriptCompiler::Source source(s); + return scope.Escape( + v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) + .FromMaybe(v8::Local())); + } + + inline MaybeLocal RunScript( + v8::Local script + ) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(script->BindToCurrentContext() + ->Run(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); + } + + inline MaybeLocal RunScript( + v8::Local script + ) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(script->Run(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); + } +#else + inline MaybeLocal + NewOneByteString(const uint8_t * value, int length = -1) { + return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); + } + + inline MaybeLocal CompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + v8::ScriptCompiler::Source source(s, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + inline MaybeLocal CompileScript( + v8::Local s + ) { + v8::ScriptCompiler::Source source(s); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); + } + + inline MaybeLocal RunScript( + v8::Local script + ) { + EscapableHandleScope scope; + return scope.Escape(script->BindToCurrentContext()->Run()); + } + + inline MaybeLocal RunScript( + v8::Local script + ) { + return script->Run(); + } +#endif + + NAN_DEPRECATED inline v8::Local MakeCallback( + v8::Local target + , v8::Local func + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv))); +#else +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource res("nan:makeCallback"); + return res.runInAsyncScope(target, func, argc, argv) + .FromMaybe(v8::Local()); +# else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, func, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + } + + NAN_DEPRECATED inline v8::Local MakeCallback( + v8::Local target + , v8::Local symbol + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv))); +#else +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource res("nan:makeCallback"); + return res.runInAsyncScope(target, symbol, argc, argv) + .FromMaybe(v8::Local()); +# else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, symbol, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + } + + NAN_DEPRECATED inline v8::Local MakeCallback( + v8::Local target + , const char* method + , int argc + , v8::Local* argv) { +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + return scope.Escape(New(node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv))); +#else +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource res("nan:makeCallback"); + return res.runInAsyncScope(target, method, argc, argv) + .FromMaybe(v8::Local()); +# else + return node::MakeCallback( + v8::Isolate::GetCurrent(), target, method, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + } + + inline void FatalException(const TryCatch& try_catch) { + node::FatalException(v8::Isolate::GetCurrent(), try_catch.try_catch_); + } + + inline v8::Local ErrnoException( + int errorno + , const char* syscall = NULL + , const char* message = NULL + , const char* path = NULL) { + return node::ErrnoException(v8::Isolate::GetCurrent(), errorno, syscall, + message, path); + } + + NAN_DEPRECATED inline v8::Local NanErrnoException( + int errorno + , const char* syscall = NULL + , const char* message = NULL + , const char* path = NULL) { + return ErrnoException(errorno, syscall, message, path); + } + + template + inline void SetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(0, data); + } + + template + inline T *GetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData(0)); + } + +class Utf8String { + public: + inline explicit Utf8String(v8::Local from) : + length_(0), str_(str_st_) { + HandleScope scope; + if (!from.IsEmpty()) { +#if NODE_MAJOR_VERSION >= 10 + v8::Local context = GetCurrentContext(); + v8::Local string = + from->ToString(context).FromMaybe(v8::Local()); +#else + v8::Local string = from->ToString(); +#endif + if (!string.IsEmpty()) { + size_t len = 3 * string->Length() + 1; + assert(len <= INT_MAX); + if (len > sizeof (str_st_)) { + str_ = static_cast(malloc(len)); + assert(str_ != 0); + } + const int flags = + v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; +#if NODE_MAJOR_VERSION >= 11 + length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, + static_cast(len), 0, flags); +#else + // See https://github.com/nodejs/nan/issues/832. + // Disable the warning as there is no way around it. +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4996) +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif // NODE_MAJOR_VERSION < 11 + str_[length_] = '\0'; + } + } + } + + inline int length() const { + return length_; + } + + inline char* operator*() { return str_; } + inline const char* operator*() const { return str_; } + + inline ~Utf8String() { + if (str_ != str_st_) { + free(str_); + } + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) + + int length_; + char *str_; + char str_st_[1024]; +}; + +#else // Node 0.8 and 0.10 + inline v8::Local Undefined() { + EscapableHandleScope scope; + return scope.Escape(New(v8::Undefined())); + } + + inline v8::Local Null() { + EscapableHandleScope scope; + return scope.Escape(New(v8::Null())); + } + + inline v8::Local True() { + EscapableHandleScope scope; + return scope.Escape(New(v8::True())); + } + + inline v8::Local False() { + EscapableHandleScope scope; + return scope.Escape(New(v8::False())); + } + + inline v8::Local EmptyString() { + return v8::String::Empty(); + } + + inline int AdjustExternalMemory(int bc) { + return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); + } + + inline void SetTemplate( + v8::Local templ + , const char *name + , v8::Local value) { + templ->Set(name, value); + } + + inline void SetTemplate( + v8::Local templ + , v8::Local name + , v8::Local value + , v8::PropertyAttribute attributes) { + templ->Set(name, value, attributes); + } + + inline v8::Local GetCurrentContext() { + return v8::Context::GetCurrent(); + } + + inline void* GetInternalFieldPointer( + v8::Local object + , int index) { + return object->GetPointerFromInternalField(index); + } + + inline void SetInternalFieldPointer( + v8::Local object + , int index + , void* value) { + object->SetPointerInInternalField(index, value); + } + +# define NAN_GC_CALLBACK(name) \ + void name(v8::GCType type, v8::GCCallbackFlags flags) + + inline void AddGCEpilogueCallback( + v8::GCEpilogueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::V8::AddGCEpilogueCallback(callback, gc_type_filter); + } + inline void RemoveGCEpilogueCallback( + v8::GCEpilogueCallback callback) { + v8::V8::RemoveGCEpilogueCallback(callback); + } + inline void AddGCPrologueCallback( + v8::GCPrologueCallback callback + , v8::GCType gc_type_filter = v8::kGCTypeAll) { + v8::V8::AddGCPrologueCallback(callback, gc_type_filter); + } + inline void RemoveGCPrologueCallback( + v8::GCPrologueCallback callback) { + v8::V8::RemoveGCPrologueCallback(callback); + } + inline void GetHeapStatistics( + v8::HeapStatistics *heap_statistics) { + v8::V8::GetHeapStatistics(heap_statistics); + } + +# define X(NAME) \ + inline v8::Local NAME(const char *msg) { \ + EscapableHandleScope scope; \ + return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ + } \ + \ + inline \ + v8::Local NAME(v8::Local msg) { \ + return v8::Exception::NAME(msg); \ + } \ + \ + inline void Throw ## NAME(const char *msg) { \ + HandleScope scope; \ + v8::ThrowException(v8::Exception::NAME(New(msg).ToLocalChecked())); \ + } \ + \ + inline \ + void Throw ## NAME(v8::Local errmsg) { \ + HandleScope scope; \ + v8::ThrowException(v8::Exception::NAME(errmsg)); \ + } + + X(Error) + X(RangeError) + X(ReferenceError) + X(SyntaxError) + X(TypeError) + +# undef X + + inline void ThrowError(v8::Local error) { + v8::ThrowException(error); + } + + inline MaybeLocal NewBuffer( + char *data + , size_t length + , node::Buffer::free_callback callback + , void *hint + ) { + EscapableHandleScope scope; + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(length <= imp::kMaxLength && "too large buffer"); + return scope.Escape( + New(node::Buffer::New(data, length, callback, hint)->handle_)); + } + + inline MaybeLocal CopyBuffer( + const char *data + , uint32_t size + ) { + EscapableHandleScope scope; + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); +#if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION + return scope.Escape(New(node::Buffer::New(data, size)->handle_)); +#else + return scope.Escape( + New(node::Buffer::New(const_cast(data), size)->handle_)); +#endif + } + + inline MaybeLocal NewBuffer(uint32_t size) { + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + EscapableHandleScope scope; + assert(size <= imp::kMaxLength && "too large buffer"); + return scope.Escape(New(node::Buffer::New(size)->handle_)); + } + + inline void FreeData(char *data, void *hint) { + (void) hint; // unused + delete[] data; + } + + inline MaybeLocal NewBuffer( + char* data + , uint32_t size + ) { + EscapableHandleScope scope; + // arbitrary buffer lengths requires + // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION + assert(size <= imp::kMaxLength && "too large buffer"); + return scope.Escape( + New(node::Buffer::New(data, size, FreeData, NULL)->handle_)); + } + +namespace imp { +inline void +widenString(std::vector *ws, const uint8_t *s, int l) { + size_t len = static_cast(l); + if (l < 0) { + len = strlen(reinterpret_cast(s)); + } + assert(len <= INT_MAX && "string too long"); + ws->resize(len); + std::copy(s, s + len, ws->begin()); // NOLINT(build/include_what_you_use) +} +} // end of namespace imp + + inline MaybeLocal + NewOneByteString(const uint8_t * value, int length = -1) { + std::vector wideString; // NOLINT(build/include_what_you_use) + imp::widenString(&wideString, value, length); + return v8::String::New(wideString.data(), + static_cast(wideString.size())); + } + + inline MaybeLocal CompileScript( + v8::Local s + , const v8::ScriptOrigin& origin + ) { + return v8::Script::Compile(s, const_cast(&origin)); + } + + inline MaybeLocal CompileScript( + v8::Local s + ) { + return v8::Script::Compile(s); + } + + inline + MaybeLocal RunScript(v8::Local script) { + return script->Run(); + } + + inline v8::Local MakeCallback( + v8::Local target + , v8::Local func + , int argc + , v8::Local* argv) { + v8::HandleScope scope; + return scope.Close(New(node::MakeCallback(target, func, argc, argv))); + } + + inline v8::Local MakeCallback( + v8::Local target + , v8::Local symbol + , int argc + , v8::Local* argv) { + v8::HandleScope scope; + return scope.Close(New(node::MakeCallback(target, symbol, argc, argv))); + } + + inline v8::Local MakeCallback( + v8::Local target + , const char* method + , int argc + , v8::Local* argv) { + v8::HandleScope scope; + return scope.Close(New(node::MakeCallback(target, method, argc, argv))); + } + + inline void FatalException(const TryCatch& try_catch) { + node::FatalException(const_cast(try_catch.try_catch_)); + } + + inline v8::Local ErrnoException( + int errorno + , const char* syscall = NULL + , const char* message = NULL + , const char* path = NULL) { + return node::ErrnoException(errorno, syscall, message, path); + } + + NAN_DEPRECATED inline v8::Local NanErrnoException( + int errorno + , const char* syscall = NULL + , const char* message = NULL + , const char* path = NULL) { + return ErrnoException(errorno, syscall, message, path); + } + + + template + inline void SetIsolateData( + v8::Isolate *isolate + , T *data + ) { + isolate->SetData(data); + } + + template + inline T *GetIsolateData( + v8::Isolate *isolate + ) { + return static_cast(isolate->GetData()); + } + +class Utf8String { + public: + inline explicit Utf8String(v8::Local from) : + length_(0), str_(str_st_) { + v8::HandleScope scope; + if (!from.IsEmpty()) { + v8::Local string = from->ToString(); + if (!string.IsEmpty()) { + size_t len = 3 * string->Length() + 1; + assert(len <= INT_MAX); + if (len > sizeof (str_st_)) { + str_ = static_cast(malloc(len)); + assert(str_ != 0); + } + const int flags = + v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; + length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); + str_[length_] = '\0'; + } + } + } + + inline int length() const { + return length_; + } + + inline char* operator*() { return str_; } + inline const char* operator*() const { return str_; } + + inline ~Utf8String() { + if (str_ != str_st_) { + free(str_); + } + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) + + int length_; + char *str_; + char str_st_[1024]; +}; + +#endif // NODE_MODULE_VERSION + +typedef void (*FreeCallback)(char *data, void *hint); + +typedef const FunctionCallbackInfo& NAN_METHOD_ARGS_TYPE; +typedef void NAN_METHOD_RETURN_TYPE; + +typedef const PropertyCallbackInfo& NAN_GETTER_ARGS_TYPE; +typedef void NAN_GETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& NAN_SETTER_ARGS_TYPE; +typedef void NAN_SETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_GETTER_ARGS_TYPE; +typedef void NAN_PROPERTY_GETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_SETTER_ARGS_TYPE; +typedef void NAN_PROPERTY_SETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_ENUMERATOR_ARGS_TYPE; +typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_DELETER_ARGS_TYPE; +typedef void NAN_PROPERTY_DELETER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_PROPERTY_QUERY_ARGS_TYPE; +typedef void NAN_PROPERTY_QUERY_RETURN_TYPE; + +typedef const PropertyCallbackInfo& NAN_INDEX_GETTER_ARGS_TYPE; +typedef void NAN_INDEX_GETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& NAN_INDEX_SETTER_ARGS_TYPE; +typedef void NAN_INDEX_SETTER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_INDEX_ENUMERATOR_ARGS_TYPE; +typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_INDEX_DELETER_ARGS_TYPE; +typedef void NAN_INDEX_DELETER_RETURN_TYPE; + +typedef const PropertyCallbackInfo& + NAN_INDEX_QUERY_ARGS_TYPE; +typedef void NAN_INDEX_QUERY_RETURN_TYPE; + +#define NAN_METHOD(name) \ + Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info) +#define NAN_GETTER(name) \ + Nan::NAN_GETTER_RETURN_TYPE name( \ + v8::Local property \ + , Nan::NAN_GETTER_ARGS_TYPE info) +#define NAN_SETTER(name) \ + Nan::NAN_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local value \ + , Nan::NAN_SETTER_ARGS_TYPE info) +#define NAN_PROPERTY_GETTER(name) \ + Nan::NAN_PROPERTY_GETTER_RETURN_TYPE name( \ + v8::Local property \ + , Nan::NAN_PROPERTY_GETTER_ARGS_TYPE info) +#define NAN_PROPERTY_SETTER(name) \ + Nan::NAN_PROPERTY_SETTER_RETURN_TYPE name( \ + v8::Local property \ + , v8::Local value \ + , Nan::NAN_PROPERTY_SETTER_ARGS_TYPE info) +#define NAN_PROPERTY_ENUMERATOR(name) \ + Nan::NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name( \ + Nan::NAN_PROPERTY_ENUMERATOR_ARGS_TYPE info) +#define NAN_PROPERTY_DELETER(name) \ + Nan::NAN_PROPERTY_DELETER_RETURN_TYPE name( \ + v8::Local property \ + , Nan::NAN_PROPERTY_DELETER_ARGS_TYPE info) +#define NAN_PROPERTY_QUERY(name) \ + Nan::NAN_PROPERTY_QUERY_RETURN_TYPE name( \ + v8::Local property \ + , Nan::NAN_PROPERTY_QUERY_ARGS_TYPE info) +# define NAN_INDEX_GETTER(name) \ + Nan::NAN_INDEX_GETTER_RETURN_TYPE name( \ + uint32_t index \ + , Nan::NAN_INDEX_GETTER_ARGS_TYPE info) +#define NAN_INDEX_SETTER(name) \ + Nan::NAN_INDEX_SETTER_RETURN_TYPE name( \ + uint32_t index \ + , v8::Local value \ + , Nan::NAN_INDEX_SETTER_ARGS_TYPE info) +#define NAN_INDEX_ENUMERATOR(name) \ + Nan::NAN_INDEX_ENUMERATOR_RETURN_TYPE \ + name(Nan::NAN_INDEX_ENUMERATOR_ARGS_TYPE info) +#define NAN_INDEX_DELETER(name) \ + Nan::NAN_INDEX_DELETER_RETURN_TYPE name( \ + uint32_t index \ + , Nan::NAN_INDEX_DELETER_ARGS_TYPE info) +#define NAN_INDEX_QUERY(name) \ + Nan::NAN_INDEX_QUERY_RETURN_TYPE name( \ + uint32_t index \ + , Nan::NAN_INDEX_QUERY_ARGS_TYPE info) + +class Callback { + public: + Callback() {} + + explicit Callback(const v8::Local &fn) : handle_(fn) {} + + ~Callback() { + handle_.Reset(); + } + + bool operator==(const Callback &other) const { + return handle_ == other.handle_; + } + + bool operator!=(const Callback &other) const { + return !operator==(other); + } + + inline + v8::Local operator*() const { return GetFunction(); } + + NAN_DEPRECATED inline v8::Local operator()( + v8::Local target + , int argc = 0 + , v8::Local argv[] = 0) const { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource async("nan:Callback:operator()"); + return Call_(isolate, target, argc, argv, &async) + .FromMaybe(v8::Local()); +# else + return Call_(isolate, target, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#else + return Call_(target, argc, argv); +#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + } + + NAN_DEPRECATED inline v8::Local operator()( + int argc = 0 + , v8::Local argv[] = 0) const { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource async("nan:Callback:operator()"); + return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), + argc, argv, &async) + .FromMaybe(v8::Local())); +# else + return scope.Escape( + Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#else + v8::HandleScope scope; + return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); +#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + } + + inline MaybeLocal operator()( + AsyncResource* resource + , int argc = 0 + , v8::Local argv[] = 0) const { + return this->Call(argc, argv, resource); + } + + inline MaybeLocal operator()( + AsyncResource* resource + , v8::Local target + , int argc = 0 + , v8::Local argv[] = 0) const { + return this->Call(target, argc, argv, resource); + } + + // TODO(kkoopa): remove + inline void SetFunction(const v8::Local &fn) { + Reset(fn); + } + + inline void Reset(const v8::Local &fn) { + handle_.Reset(fn); + } + + inline void Reset() { + handle_.Reset(); + } + + inline v8::Local GetFunction() const { + return New(handle_); + } + + inline bool IsEmpty() const { + return handle_.IsEmpty(); + } + + // Deprecated: For async callbacks Use the versions that accept an + // AsyncResource. If this callback does not correspond to an async resource, + // that is, it is a synchronous function call on a non-empty JS stack, you + // should Nan::Call instead. + NAN_DEPRECATED inline v8::Local + Call(v8::Local target + , int argc + , v8::Local argv[]) const { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource async("nan:Callback:Call"); + return Call_(isolate, target, argc, argv, &async) + .FromMaybe(v8::Local()); +# else + return Call_(isolate, target, argc, argv); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#else + return Call_(target, argc, argv); +#endif + } + + // Deprecated: For async callbacks Use the versions that accept an + // AsyncResource. If this callback does not correspond to an async resource, + // that is, it is a synchronous function call on a non-empty JS stack, you + // should Nan::Call instead. + NAN_DEPRECATED inline v8::Local + Call(int argc, v8::Local argv[]) const { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); +# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + AsyncResource async("nan:Callback:Call"); + return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), + argc, argv, &async) + .FromMaybe(v8::Local())); +# else + return scope.Escape( + Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); +# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION +#else + v8::HandleScope scope; + return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); +#endif + } + + inline MaybeLocal + Call(v8::Local target + , int argc + , v8::Local argv[] + , AsyncResource* resource) const { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + return Call_(isolate, target, argc, argv, resource); +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + return Call_(isolate, target, argc, argv); +#else + return Call_(target, argc, argv); +#endif + } + + inline MaybeLocal + Call(int argc, v8::Local argv[], AsyncResource* resource) const { +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + return Call(isolate->GetCurrentContext()->Global(), argc, argv, resource); +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); +#else + v8::HandleScope scope; + return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); +#endif + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(Callback) + Persistent handle_; + +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + MaybeLocal Call_(v8::Isolate *isolate + , v8::Local target + , int argc + , v8::Local argv[] + , AsyncResource* resource) const { + EscapableHandleScope scope; + v8::Local func = New(handle_); + auto maybe = resource->runInAsyncScope(target, func, argc, argv); + v8::Local local; + if (!maybe.ToLocal(&local)) return MaybeLocal(); + return scope.Escape(local); + } +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Local Call_(v8::Isolate *isolate + , v8::Local target + , int argc + , v8::Local argv[]) const { + EscapableHandleScope scope; + + v8::Local callback = New(handle_); +# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION + return scope.Escape(New(node::MakeCallback( + isolate + , target + , callback + , argc + , argv + ))); +# else + return scope.Escape(node::MakeCallback( + isolate + , target + , callback + , argc + , argv + )); +# endif + } +#else + v8::Local Call_(v8::Local target + , int argc + , v8::Local argv[]) const { + EscapableHandleScope scope; + + v8::Local callback = New(handle_); + return scope.Escape(New(node::MakeCallback( + target + , callback + , argc + , argv + ))); + } +#endif +}; + +inline MaybeLocal Call( + const Nan::Callback& callback + , v8::Local recv + , int argc + , v8::Local argv[]) { + return Call(*callback, recv, argc, argv); +} + +inline MaybeLocal Call( + const Nan::Callback& callback + , int argc + , v8::Local argv[]) { +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + Call(*callback, isolate->GetCurrentContext()->Global(), argc, argv) + .FromMaybe(v8::Local())); +#else + EscapableHandleScope scope; + return scope.Escape( + Call(*callback, v8::Context::GetCurrent()->Global(), argc, argv) + .FromMaybe(v8::Local())); +#endif +} + +inline MaybeLocal Call( + v8::Local symbol + , v8::Local recv + , int argc + , v8::Local argv[]) { + EscapableHandleScope scope; + v8::Local fn_v = + Get(recv, symbol).FromMaybe(v8::Local()); + if (fn_v.IsEmpty() || !fn_v->IsFunction()) return v8::Local(); + v8::Local fn = fn_v.As(); + return scope.Escape( + Call(fn, recv, argc, argv).FromMaybe(v8::Local())); +} + +inline MaybeLocal Call( + const char* method + , v8::Local recv + , int argc + , v8::Local argv[]) { + EscapableHandleScope scope; + v8::Local method_string = + New(method).ToLocalChecked(); + return scope.Escape( + Call(method_string, recv, argc, argv).FromMaybe(v8::Local())); +} + +/* abstract */ class AsyncWorker { + public: + explicit AsyncWorker(Callback *callback_, + const char* resource_name = "nan:AsyncWorker") + : callback(callback_), errmsg_(NULL) { + request.data = this; + + HandleScope scope; + v8::Local obj = New(); + persistentHandle.Reset(obj); + async_resource = new AsyncResource(resource_name, obj); + } + + virtual ~AsyncWorker() { + HandleScope scope; + + if (!persistentHandle.IsEmpty()) + persistentHandle.Reset(); + delete callback; + delete[] errmsg_; + delete async_resource; + } + + virtual void WorkComplete() { + HandleScope scope; + + if (errmsg_ == NULL) + HandleOKCallback(); + else + HandleErrorCallback(); + delete callback; + callback = NULL; + } + + inline void SaveToPersistent( + const char *key, const v8::Local &value) { + HandleScope scope; + Set(New(persistentHandle), New(key).ToLocalChecked(), value).FromJust(); + } + + inline void SaveToPersistent( + const v8::Local &key, const v8::Local &value) { + HandleScope scope; + Set(New(persistentHandle), key, value).FromJust(); + } + + inline void SaveToPersistent( + uint32_t index, const v8::Local &value) { + HandleScope scope; + Set(New(persistentHandle), index, value).FromJust(); + } + + inline v8::Local GetFromPersistent(const char *key) const { + EscapableHandleScope scope; + return scope.Escape( + Get(New(persistentHandle), New(key).ToLocalChecked()) + .FromMaybe(v8::Local())); + } + + inline v8::Local + GetFromPersistent(const v8::Local &key) const { + EscapableHandleScope scope; + return scope.Escape( + Get(New(persistentHandle), key) + .FromMaybe(v8::Local())); + } + + inline v8::Local GetFromPersistent(uint32_t index) const { + EscapableHandleScope scope; + return scope.Escape( + Get(New(persistentHandle), index) + .FromMaybe(v8::Local())); + } + + virtual void Execute() = 0; + + uv_work_t request; + + virtual void Destroy() { + delete this; + } + + protected: + Persistent persistentHandle; + Callback *callback; + AsyncResource *async_resource; + + virtual void HandleOKCallback() { + HandleScope scope; + + callback->Call(0, NULL, async_resource); + } + + virtual void HandleErrorCallback() { + HandleScope scope; + + v8::Local argv[] = { + v8::Exception::Error(New(ErrorMessage()).ToLocalChecked()) + }; + callback->Call(1, argv, async_resource); + } + + void SetErrorMessage(const char *msg) { + delete[] errmsg_; + + size_t size = strlen(msg) + 1; + errmsg_ = new char[size]; + memcpy(errmsg_, msg, size); + } + + const char* ErrorMessage() const { + return errmsg_; + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncWorker) + char *errmsg_; +}; + +/* abstract */ class AsyncBareProgressWorkerBase : public AsyncWorker { + public: + explicit AsyncBareProgressWorkerBase( + Callback *callback_, + const char* resource_name = "nan:AsyncBareProgressWorkerBase") + : AsyncWorker(callback_, resource_name) { + uv_async_init( + GetCurrentEventLoop() + , &async + , AsyncProgress_ + ); + async.data = this; + } + + virtual ~AsyncBareProgressWorkerBase() { + } + + virtual void WorkProgress() = 0; + + virtual void Destroy() { + uv_close(reinterpret_cast(&async), AsyncClose_); + } + + private: + inline static NAUV_WORK_CB(AsyncProgress_) { + AsyncBareProgressWorkerBase *worker = + static_cast(async->data); + worker->WorkProgress(); + } + + inline static void AsyncClose_(uv_handle_t* handle) { + AsyncBareProgressWorkerBase *worker = + static_cast(handle->data); + delete worker; + } + + protected: + uv_async_t async; +}; + +template +/* abstract */ +class AsyncBareProgressWorker : public AsyncBareProgressWorkerBase { + public: + explicit AsyncBareProgressWorker( + Callback *callback_, + const char* resource_name = "nan:AsyncBareProgressWorker") + : AsyncBareProgressWorkerBase(callback_, resource_name) { + uv_mutex_init(&async_lock); + } + + virtual ~AsyncBareProgressWorker() { + uv_mutex_destroy(&async_lock); + } + + class ExecutionProgress { + friend class AsyncBareProgressWorker; + public: + void Signal() const { + uv_mutex_lock(&that_->async_lock); + uv_async_send(&that_->async); + uv_mutex_unlock(&that_->async_lock); + } + + void Send(const T* data, size_t count) const { + that_->SendProgress_(data, count); + } + + private: + explicit ExecutionProgress(AsyncBareProgressWorker *that) : that_(that) {} + NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) + AsyncBareProgressWorker* const that_; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void HandleProgressCallback(const T *data, size_t size) = 0; + + protected: + uv_mutex_t async_lock; + + private: + void Execute() /*final override*/ { + ExecutionProgress progress(this); + Execute(progress); + } + + virtual void SendProgress_(const T *data, size_t count) = 0; +}; + +template +/* abstract */ +class AsyncProgressWorkerBase : public AsyncBareProgressWorker { + public: + explicit AsyncProgressWorkerBase( + Callback *callback_, + const char* resource_name = "nan:AsyncProgressWorkerBase") + : AsyncBareProgressWorker(callback_, resource_name), asyncdata_(NULL), + asyncsize_(0) { + } + + virtual ~AsyncProgressWorkerBase() { + delete[] asyncdata_; + } + + void WorkProgress() { + uv_mutex_lock(&this->async_lock); + T *data = asyncdata_; + size_t size = asyncsize_; + asyncdata_ = NULL; + asyncsize_ = 0; + uv_mutex_unlock(&this->async_lock); + + // Don't send progress events after we've already completed. + if (this->callback) { + this->HandleProgressCallback(data, size); + } + delete[] data; + } + + private: + void SendProgress_(const T *data, size_t count) { + T *new_data = new T[count]; + std::copy(data, data + count, new_data); + + uv_mutex_lock(&this->async_lock); + T *old_data = asyncdata_; + asyncdata_ = new_data; + asyncsize_ = count; + uv_async_send(&this->async); + uv_mutex_unlock(&this->async_lock); + + delete[] old_data; + } + + T *asyncdata_; + size_t asyncsize_; +}; + +// This ensures compatibility to the previous un-templated AsyncProgressWorker +// class definition. +typedef AsyncProgressWorkerBase AsyncProgressWorker; + +template +/* abstract */ +class AsyncBareProgressQueueWorker : public AsyncBareProgressWorkerBase { + public: + explicit AsyncBareProgressQueueWorker( + Callback *callback_, + const char* resource_name = "nan:AsyncBareProgressQueueWorker") + : AsyncBareProgressWorkerBase(callback_, resource_name) { + } + + virtual ~AsyncBareProgressQueueWorker() { + } + + class ExecutionProgress { + friend class AsyncBareProgressQueueWorker; + public: + void Send(const T* data, size_t count) const { + that_->SendProgress_(data, count); + } + + private: + explicit ExecutionProgress(AsyncBareProgressQueueWorker *that) + : that_(that) {} + NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) + AsyncBareProgressQueueWorker* const that_; + }; + + virtual void Execute(const ExecutionProgress& progress) = 0; + virtual void HandleProgressCallback(const T *data, size_t size) = 0; + + private: + void Execute() /*final override*/ { + ExecutionProgress progress(this); + Execute(progress); + } + + virtual void SendProgress_(const T *data, size_t count) = 0; +}; + +template +/* abstract */ +class AsyncProgressQueueWorker : public AsyncBareProgressQueueWorker { + public: + explicit AsyncProgressQueueWorker( + Callback *callback_, + const char* resource_name = "nan:AsyncProgressQueueWorker") + : AsyncBareProgressQueueWorker(callback_) { + uv_mutex_init(&async_lock); + } + + virtual ~AsyncProgressQueueWorker() { + uv_mutex_lock(&async_lock); + + while (!asyncdata_.empty()) { + std::pair &datapair = asyncdata_.front(); + T *data = datapair.first; + + asyncdata_.pop(); + + delete[] data; + } + + uv_mutex_unlock(&async_lock); + uv_mutex_destroy(&async_lock); + } + + void WorkComplete() { + WorkProgress(); + AsyncWorker::WorkComplete(); + } + + void WorkProgress() { + uv_mutex_lock(&async_lock); + + while (!asyncdata_.empty()) { + std::pair &datapair = asyncdata_.front(); + + T *data = datapair.first; + size_t size = datapair.second; + + asyncdata_.pop(); + uv_mutex_unlock(&async_lock); + + // Don't send progress events after we've already completed. + if (this->callback) { + this->HandleProgressCallback(data, size); + } + + delete[] data; + + uv_mutex_lock(&async_lock); + } + + uv_mutex_unlock(&async_lock); + } + + private: + void SendProgress_(const T *data, size_t count) { + T *new_data = new T[count]; + std::copy(data, data + count, new_data); + + uv_mutex_lock(&async_lock); + asyncdata_.push(std::pair(new_data, count)); + uv_mutex_unlock(&async_lock); + + uv_async_send(&this->async); + } + + uv_mutex_t async_lock; + std::queue > asyncdata_; +}; + +inline void AsyncExecute (uv_work_t* req) { + AsyncWorker *worker = static_cast(req->data); + worker->Execute(); +} + +inline void AsyncExecuteComplete (uv_work_t* req) { + AsyncWorker* worker = static_cast(req->data); + worker->WorkComplete(); + worker->Destroy(); +} + +inline void AsyncQueueWorker (AsyncWorker* worker) { + uv_queue_work( + GetCurrentEventLoop() + , &worker->request + , AsyncExecute + , reinterpret_cast(AsyncExecuteComplete) + ); +} + +namespace imp { + +inline +ExternalOneByteStringResource const* +GetExternalResource(v8::Local str) { +#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION + return str->GetExternalAsciiStringResource(); +#else + return str->GetExternalOneByteStringResource(); +#endif +} + +inline +bool +IsExternal(v8::Local str) { +#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION + return str->IsExternalAscii(); +#else + return str->IsExternalOneByte(); +#endif +} + +} // end of namespace imp + +enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; + +#if NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION +# include "nan_string_bytes.h" // NOLINT(build/include) +#endif + +inline v8::Local Encode( + const void *buf, size_t len, enum Encoding encoding = BINARY) { +#if (NODE_MODULE_VERSION >= ATOM_0_21_MODULE_VERSION) + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + node::encoding node_enc = static_cast(encoding); + + if (encoding == UCS2) { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len / 2); + } else { + return node::Encode( + isolate + , reinterpret_cast(buf) + , len + , node_enc); + } +#elif (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) + return node::Encode( + v8::Isolate::GetCurrent() + , buf, len + , static_cast(encoding)); +#else +# if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION + return node::Encode(buf, len, static_cast(encoding)); +# else + return imp::Encode(reinterpret_cast(buf), len, encoding); +# endif +#endif +} + +inline ssize_t DecodeBytes( + v8::Local val, enum Encoding encoding = BINARY) { +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) + return node::DecodeBytes( + v8::Isolate::GetCurrent() + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) + if (encoding == BUFFER) { + return node::DecodeBytes(val, node::BINARY); + } +# endif + return node::DecodeBytes(val, static_cast(encoding)); +#endif +} + +inline ssize_t DecodeWrite( + char *buf + , size_t len + , v8::Local val + , enum Encoding encoding = BINARY) { +#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) + return node::DecodeWrite( + v8::Isolate::GetCurrent() + , buf + , len + , val + , static_cast(encoding)); +#else +# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) + if (encoding == BUFFER) { + return node::DecodeWrite(buf, len, val, node::BINARY); + } +# endif + return node::DecodeWrite( + buf + , len + , val + , static_cast(encoding)); +#endif +} + +inline void SetPrototypeTemplate( + v8::Local templ + , const char *name + , v8::Local value +) { + HandleScope scope; + SetTemplate(templ->PrototypeTemplate(), name, value); +} + +inline void SetPrototypeTemplate( + v8::Local templ + , v8::Local name + , v8::Local value + , v8::PropertyAttribute attributes +) { + HandleScope scope; + SetTemplate(templ->PrototypeTemplate(), name, value, attributes); +} + +inline void SetInstanceTemplate( + v8::Local templ + , const char *name + , v8::Local value +) { + HandleScope scope; + SetTemplate(templ->InstanceTemplate(), name, value); +} + +inline void SetInstanceTemplate( + v8::Local templ + , v8::Local name + , v8::Local value + , v8::PropertyAttribute attributes +) { + HandleScope scope; + SetTemplate(templ->InstanceTemplate(), name, value, attributes); +} + +namespace imp { + +// Note(@agnat): Helper to distinguish different receiver types. The first +// version deals with receivers derived from v8::Template. The second version +// handles everything else. The final argument only serves as discriminator and +// is unused. +template +inline +void +SetMethodAux(T recv, + v8::Local name, + v8::Local tpl, + v8::Template *) { + recv->Set(name, tpl); +} + +template +inline +void +SetMethodAux(T recv, + v8::Local name, + v8::Local tpl, + ...) { + Set(recv, name, GetFunction(tpl).ToLocalChecked()); +} + +} // end of namespace imp + +template class HandleType> +inline void SetMethod( + HandleType recv + , const char *name + , FunctionCallback callback + , v8::Local data = v8::Local()) { + HandleScope scope; + v8::Local t = New(callback, data); + v8::Local fn_name = New(name).ToLocalChecked(); + t->SetClassName(fn_name); + // Note(@agnat): Pass an empty T* as discriminator. See note on + // SetMethodAux(...) above + imp::SetMethodAux(recv, fn_name, t, static_cast(0)); +} + +inline void SetPrototypeMethod( + v8::Local recv + , const char* name + , FunctionCallback callback + , v8::Local data = v8::Local()) { + HandleScope scope; + v8::Local t = New( + callback + , data + , New(recv)); + v8::Local fn_name = New(name).ToLocalChecked(); + recv->PrototypeTemplate()->Set(fn_name, t); + t->SetClassName(fn_name); +} + +//=== Accessors and Such ======================================================= + +inline void SetAccessor( + v8::Local tpl + , v8::Local name + , GetterCallback getter + , SetterCallback setter = 0 + , v8::Local data = v8::Local() + , v8::AccessControl settings = v8::DEFAULT + , v8::PropertyAttribute attribute = v8::None + , imp::Sig signature = imp::Sig()) { + HandleScope scope; + + imp::NativeGetter getter_ = + imp::GetterCallbackWrapper; + imp::NativeSetter setter_ = + setter ? imp::SetterCallbackWrapper : 0; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kAccessorFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kGetterIndex + , New(reinterpret_cast(getter))); + + if (setter != 0) { + obj->SetInternalField( + imp::kSetterIndex + , New(reinterpret_cast(setter))); + } + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + + tpl->SetAccessor( + name + , getter_ + , setter_ + , obj + , settings + , attribute + , signature); +} + +inline bool SetAccessor( + v8::Local obj + , v8::Local name + , GetterCallback getter + , SetterCallback setter = 0 + , v8::Local data = v8::Local() + , v8::AccessControl settings = v8::DEFAULT + , v8::PropertyAttribute attribute = v8::None) { + HandleScope scope; + + imp::NativeGetter getter_ = + imp::GetterCallbackWrapper; + imp::NativeSetter setter_ = + setter ? imp::SetterCallbackWrapper : 0; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kAccessorFieldCount); + v8::Local dataobj = NewInstance(otpl).ToLocalChecked(); + + dataobj->SetInternalField( + imp::kGetterIndex + , New(reinterpret_cast(getter))); + + if (!data.IsEmpty()) { + dataobj->SetInternalField(imp::kDataIndex, data); + } + + if (setter) { + dataobj->SetInternalField( + imp::kSetterIndex + , New(reinterpret_cast(setter))); + } + +#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) + return obj->SetAccessor( + GetCurrentContext() + , name + , getter_ + , setter_ + , dataobj + , settings + , attribute).FromMaybe(false); +#else + return obj->SetAccessor( + name + , getter_ + , setter_ + , dataobj + , settings + , attribute); +#endif +} + +inline void SetNamedPropertyHandler( + v8::Local tpl + , PropertyGetterCallback getter + , PropertySetterCallback setter = 0 + , PropertyQueryCallback query = 0 + , PropertyDeleterCallback deleter = 0 + , PropertyEnumeratorCallback enumerator = 0 + , v8::Local data = v8::Local()) { + HandleScope scope; + + imp::NativePropertyGetter getter_ = + imp::PropertyGetterCallbackWrapper; + imp::NativePropertySetter setter_ = + setter ? imp::PropertySetterCallbackWrapper : 0; + imp::NativePropertyQuery query_ = + query ? imp::PropertyQueryCallbackWrapper : 0; + imp::NativePropertyDeleter *deleter_ = + deleter ? imp::PropertyDeleterCallbackWrapper : 0; + imp::NativePropertyEnumerator enumerator_ = + enumerator ? imp::PropertyEnumeratorCallbackWrapper : 0; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kPropertyFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + obj->SetInternalField( + imp::kPropertyGetterIndex + , New(reinterpret_cast(getter))); + + if (setter) { + obj->SetInternalField( + imp::kPropertySetterIndex + , New(reinterpret_cast(setter))); + } + + if (query) { + obj->SetInternalField( + imp::kPropertyQueryIndex + , New(reinterpret_cast(query))); + } + + if (deleter) { + obj->SetInternalField( + imp::kPropertyDeleterIndex + , New(reinterpret_cast(deleter))); + } + + if (enumerator) { + obj->SetInternalField( + imp::kPropertyEnumeratorIndex + , New(reinterpret_cast(enumerator))); + } + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION + tpl->SetHandler(v8::NamedPropertyHandlerConfiguration( + getter_, setter_, query_, deleter_, enumerator_, obj)); +#else + tpl->SetNamedPropertyHandler( + getter_ + , setter_ + , query_ + , deleter_ + , enumerator_ + , obj); +#endif +} + +inline void SetIndexedPropertyHandler( + v8::Local tpl + , IndexGetterCallback getter + , IndexSetterCallback setter = 0 + , IndexQueryCallback query = 0 + , IndexDeleterCallback deleter = 0 + , IndexEnumeratorCallback enumerator = 0 + , v8::Local data = v8::Local()) { + HandleScope scope; + + imp::NativeIndexGetter getter_ = + imp::IndexGetterCallbackWrapper; + imp::NativeIndexSetter setter_ = + setter ? imp::IndexSetterCallbackWrapper : 0; + imp::NativeIndexQuery query_ = + query ? imp::IndexQueryCallbackWrapper : 0; + imp::NativeIndexDeleter deleter_ = + deleter ? imp::IndexDeleterCallbackWrapper : 0; + imp::NativeIndexEnumerator enumerator_ = + enumerator ? imp::IndexEnumeratorCallbackWrapper : 0; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kIndexPropertyFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + obj->SetInternalField( + imp::kIndexPropertyGetterIndex + , New(reinterpret_cast(getter))); + + if (setter) { + obj->SetInternalField( + imp::kIndexPropertySetterIndex + , New(reinterpret_cast(setter))); + } + + if (query) { + obj->SetInternalField( + imp::kIndexPropertyQueryIndex + , New(reinterpret_cast(query))); + } + + if (deleter) { + obj->SetInternalField( + imp::kIndexPropertyDeleterIndex + , New(reinterpret_cast(deleter))); + } + + if (enumerator) { + obj->SetInternalField( + imp::kIndexPropertyEnumeratorIndex + , New(reinterpret_cast(enumerator))); + } + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION + tpl->SetHandler(v8::IndexedPropertyHandlerConfiguration( + getter_, setter_, query_, deleter_, enumerator_, obj)); +#else + tpl->SetIndexedPropertyHandler( + getter_ + , setter_ + , query_ + , deleter_ + , enumerator_ + , obj); +#endif +} + +inline void SetCallHandler( + v8::Local tpl + , FunctionCallback callback + , v8::Local data = v8::Local()) { + HandleScope scope; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kFunctionIndex + , New(reinterpret_cast(callback))); + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + + tpl->SetCallHandler(imp::FunctionCallbackWrapper, obj); +} + + +inline void SetCallAsFunctionHandler( + v8::Local tpl, + FunctionCallback callback, + v8::Local data = v8::Local()) { + HandleScope scope; + + v8::Local otpl = New(); + otpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = NewInstance(otpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kFunctionIndex + , New(reinterpret_cast(callback))); + + if (!data.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, data); + } + + tpl->SetCallAsFunctionHandler(imp::FunctionCallbackWrapper, obj); +} + +//=== Weak Persistent Handling ================================================= + +#include "nan_weak.h" // NOLINT(build/include) + +//=== ObjectWrap =============================================================== + +#include "nan_object_wrap.h" // NOLINT(build/include) + +//=== HiddenValue/Private ====================================================== + +#include "nan_private.h" // NOLINT(build/include) + +//=== Export ================================================================== + +inline +void +Export(ADDON_REGISTER_FUNCTION_ARGS_TYPE target, const char *name, + FunctionCallback f) { + HandleScope scope; + + Set(target, New(name).ToLocalChecked(), + GetFunction(New(f)).ToLocalChecked()); +} + +//=== Tap Reverse Binding ===================================================== + +struct Tap { + explicit Tap(v8::Local t) : t_() { + HandleScope scope; + + t_.Reset(To(t).ToLocalChecked()); + } + + ~Tap() { t_.Reset(); } // not sure if necessary + + inline void plan(int i) { + HandleScope scope; + v8::Local arg = New(i); + Call("plan", New(t_), 1, &arg); + } + + inline void ok(bool isOk, const char *msg = NULL) { + HandleScope scope; + v8::Local args[2]; + args[0] = New(isOk); + if (msg) args[1] = New(msg).ToLocalChecked(); + Call("ok", New(t_), msg ? 2 : 1, args); + } + + inline void pass(const char * msg = NULL) { + HandleScope scope; + v8::Local hmsg; + if (msg) hmsg = New(msg).ToLocalChecked(); + Call("pass", New(t_), msg ? 1 : 0, &hmsg); + } + + inline void end() { + HandleScope scope; + Call("end", New(t_), 0, NULL); + } + + private: + Persistent t_; +}; + +#define NAN_STRINGIZE2(x) #x +#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) +#define NAN_TEST_EXPRESSION(expression) \ + ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression + +#define NAN_EXPORT(target, function) Export(target, #function, function) + +#undef TYPE_CHECK + +//=== Generic Maybefication =================================================== + +namespace imp { + +template struct Maybefier; + +template struct Maybefier > { + inline static MaybeLocal convert(v8::Local v) { + return v; + } +}; + +template struct Maybefier > { + inline static MaybeLocal convert(MaybeLocal v) { + return v; + } +}; + +} // end of namespace imp + +template class MaybeMaybe> +inline MaybeLocal +MakeMaybe(MaybeMaybe v) { + return imp::Maybefier >::convert(v); +} + +//=== TypedArrayContents ======================================================= + +#include "nan_typedarray_contents.h" // NOLINT(build/include) + +//=== JSON ===================================================================== + +#include "nan_json.h" // NOLINT(build/include) + +} // end of namespace Nan + +#endif // NAN_H_ diff --git a/node_modules/nan/nan_callbacks.h b/node_modules/nan/nan_callbacks.h new file mode 100644 index 00000000..53ede846 --- /dev/null +++ b/node_modules/nan/nan_callbacks.h @@ -0,0 +1,88 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CALLBACKS_H_ +#define NAN_CALLBACKS_H_ + +template class FunctionCallbackInfo; +template class PropertyCallbackInfo; +template class Global; + +typedef void(*FunctionCallback)(const FunctionCallbackInfo&); +typedef void(*GetterCallback) + (v8::Local, const PropertyCallbackInfo&); +typedef void(*SetterCallback)( + v8::Local, + v8::Local, + const PropertyCallbackInfo&); +typedef void(*PropertyGetterCallback)( + v8::Local, + const PropertyCallbackInfo&); +typedef void(*PropertySetterCallback)( + v8::Local, + v8::Local, + const PropertyCallbackInfo&); +typedef void(*PropertyEnumeratorCallback) + (const PropertyCallbackInfo&); +typedef void(*PropertyDeleterCallback)( + v8::Local, + const PropertyCallbackInfo&); +typedef void(*PropertyQueryCallback)( + v8::Local, + const PropertyCallbackInfo&); +typedef void(*IndexGetterCallback)( + uint32_t, + const PropertyCallbackInfo&); +typedef void(*IndexSetterCallback)( + uint32_t, + v8::Local, + const PropertyCallbackInfo&); +typedef void(*IndexEnumeratorCallback) + (const PropertyCallbackInfo&); +typedef void(*IndexDeleterCallback)( + uint32_t, + const PropertyCallbackInfo&); +typedef void(*IndexQueryCallback)( + uint32_t, + const PropertyCallbackInfo&); + +namespace imp { +typedef v8::Local Sig; + +static const int kDataIndex = 0; + +static const int kFunctionIndex = 1; +static const int kFunctionFieldCount = 2; + +static const int kGetterIndex = 1; +static const int kSetterIndex = 2; +static const int kAccessorFieldCount = 3; + +static const int kPropertyGetterIndex = 1; +static const int kPropertySetterIndex = 2; +static const int kPropertyEnumeratorIndex = 3; +static const int kPropertyDeleterIndex = 4; +static const int kPropertyQueryIndex = 5; +static const int kPropertyFieldCount = 6; + +static const int kIndexPropertyGetterIndex = 1; +static const int kIndexPropertySetterIndex = 2; +static const int kIndexPropertyEnumeratorIndex = 3; +static const int kIndexPropertyDeleterIndex = 4; +static const int kIndexPropertyQueryIndex = 5; +static const int kIndexPropertyFieldCount = 6; + +} // end of namespace imp + +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +# include "nan_callbacks_12_inl.h" // NOLINT(build/include) +#else +# include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include) +#endif + +#endif // NAN_CALLBACKS_H_ diff --git a/node_modules/nan/nan_callbacks_12_inl.h b/node_modules/nan/nan_callbacks_12_inl.h new file mode 100644 index 00000000..c27b18d8 --- /dev/null +++ b/node_modules/nan/nan_callbacks_12_inl.h @@ -0,0 +1,514 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CALLBACKS_12_INL_H_ +#define NAN_CALLBACKS_12_INL_H_ + +template +class ReturnValue { + v8::ReturnValue value_; + + public: + template + explicit inline ReturnValue(const v8::ReturnValue &value) : + value_(value) {} + template + explicit inline ReturnValue(const ReturnValue& that) + : value_(that.value_) { + TYPE_CHECK(T, S); + } + + // Handle setters + template inline void Set(const v8::Local &handle) { + TYPE_CHECK(T, S); + value_.Set(handle); + } + + template inline void Set(const Global &handle) { + TYPE_CHECK(T, S); +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && \ + (V8_MINOR_VERSION > 5 || (V8_MINOR_VERSION == 5 && \ + defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER >= 8)))) + value_.Set(handle); +#else + value_.Set(*reinterpret_cast*>(&handle)); + const_cast &>(handle).Reset(); +#endif + } + + // Fast primitive setters + inline void Set(bool value) { + TYPE_CHECK(T, v8::Boolean); + value_.Set(value); + } + + inline void Set(double i) { + TYPE_CHECK(T, v8::Number); + value_.Set(i); + } + + inline void Set(int32_t i) { + TYPE_CHECK(T, v8::Integer); + value_.Set(i); + } + + inline void Set(uint32_t i) { + TYPE_CHECK(T, v8::Integer); + value_.Set(i); + } + + // Fast JS primitive setters + inline void SetNull() { + TYPE_CHECK(T, v8::Primitive); + value_.SetNull(); + } + + inline void SetUndefined() { + TYPE_CHECK(T, v8::Primitive); + value_.SetUndefined(); + } + + inline void SetEmptyString() { + TYPE_CHECK(T, v8::String); + value_.SetEmptyString(); + } + + // Convenience getter for isolate + inline v8::Isolate *GetIsolate() const { + return value_.GetIsolate(); + } + + // Pointer setter: Uncompilable to prevent inadvertent misuse. + template + inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } +}; + +template +class FunctionCallbackInfo { + const v8::FunctionCallbackInfo &info_; + const v8::Local data_; + + public: + explicit inline FunctionCallbackInfo( + const v8::FunctionCallbackInfo &info + , v8::Local data) : + info_(info) + , data_(data) {} + + inline ReturnValue GetReturnValue() const { + return ReturnValue(info_.GetReturnValue()); + } + +#if NODE_MAJOR_VERSION < 10 + inline v8::Local Callee() const { return info_.Callee(); } +#endif + inline v8::Local Data() const { return data_; } + inline v8::Local Holder() const { return info_.Holder(); } + inline bool IsConstructCall() const { return info_.IsConstructCall(); } + inline int Length() const { return info_.Length(); } + inline v8::Local operator[](int i) const { return info_[i]; } + inline v8::Local This() const { return info_.This(); } + inline v8::Isolate *GetIsolate() const { return info_.GetIsolate(); } + + + protected: + static const int kHolderIndex = 0; + static const int kIsolateIndex = 1; + static const int kReturnValueDefaultValueIndex = 2; + static const int kReturnValueIndex = 3; + static const int kDataIndex = 4; + static const int kCalleeIndex = 5; + static const int kContextSaveIndex = 6; + static const int kArgsLength = 7; + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) +}; + +template +class PropertyCallbackInfo { + const v8::PropertyCallbackInfo &info_; + const v8::Local data_; + + public: + explicit inline PropertyCallbackInfo( + const v8::PropertyCallbackInfo &info + , const v8::Local data) : + info_(info) + , data_(data) {} + + inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } + inline v8::Local Data() const { return data_; } + inline v8::Local This() const { return info_.This(); } + inline v8::Local Holder() const { return info_.Holder(); } + inline ReturnValue GetReturnValue() const { + return ReturnValue(info_.GetReturnValue()); + } + + protected: + static const int kHolderIndex = 0; + static const int kIsolateIndex = 1; + static const int kReturnValueDefaultValueIndex = 2; + static const int kReturnValueIndex = 3; + static const int kDataIndex = 4; + static const int kThisIndex = 5; + static const int kArgsLength = 6; + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo) +}; + +namespace imp { +static +void FunctionCallbackWrapper(const v8::FunctionCallbackInfo &info) { + v8::Local obj = info.Data().As(); + FunctionCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kFunctionIndex).As()->Value())); + FunctionCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + callback(cbinfo); +} + +typedef void (*NativeFunction)(const v8::FunctionCallbackInfo &); + +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION +static +void GetterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + GetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kGetterIndex).As()->Value())); + callback(property.As(), cbinfo); +} + +typedef void (*NativeGetter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void SetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + SetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kSetterIndex).As()->Value())); + callback(property.As(), value, cbinfo); +} + +typedef void (*NativeSetter)( + v8::Local + , v8::Local + , const v8::PropertyCallbackInfo &); +#else +static +void GetterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + GetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kGetterIndex).As()->Value())); + callback(property, cbinfo); +} + +typedef void (*NativeGetter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void SetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + SetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kSetterIndex).As()->Value())); + callback(property, value, cbinfo); +} + +typedef void (*NativeSetter)( + v8::Local + , v8::Local + , const v8::PropertyCallbackInfo &); +#endif + +#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION +static +void PropertyGetterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyGetterIndex) + .As()->Value())); + callback(property.As(), cbinfo); +} + +typedef void (*NativePropertyGetter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void PropertySetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertySetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertySetterIndex) + .As()->Value())); + callback(property.As(), value, cbinfo); +} + +typedef void (*NativePropertySetter)( + v8::Local + , v8::Local + , const v8::PropertyCallbackInfo &); + +static +void PropertyEnumeratorCallbackWrapper( + const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyEnumeratorCallback callback = + reinterpret_cast(reinterpret_cast( + obj->GetInternalField(kPropertyEnumeratorIndex) + .As()->Value())); + callback(cbinfo); +} + +typedef void (*NativePropertyEnumerator) + (const v8::PropertyCallbackInfo &); + +static +void PropertyDeleterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyDeleterIndex) + .As()->Value())); + callback(property.As(), cbinfo); +} + +typedef void (NativePropertyDeleter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void PropertyQueryCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyQueryIndex) + .As()->Value())); + callback(property.As(), cbinfo); +} + +typedef void (*NativePropertyQuery) + (v8::Local, const v8::PropertyCallbackInfo &); +#else +static +void PropertyGetterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyGetterIndex) + .As()->Value())); + callback(property, cbinfo); +} + +typedef void (*NativePropertyGetter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void PropertySetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertySetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertySetterIndex) + .As()->Value())); + callback(property, value, cbinfo); +} + +typedef void (*NativePropertySetter)( + v8::Local + , v8::Local + , const v8::PropertyCallbackInfo &); + +static +void PropertyEnumeratorCallbackWrapper( + const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyEnumeratorCallback callback = + reinterpret_cast(reinterpret_cast( + obj->GetInternalField(kPropertyEnumeratorIndex) + .As()->Value())); + callback(cbinfo); +} + +typedef void (*NativePropertyEnumerator) + (const v8::PropertyCallbackInfo &); + +static +void PropertyDeleterCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyDeleterIndex) + .As()->Value())); + callback(property, cbinfo); +} + +typedef void (NativePropertyDeleter) + (v8::Local, const v8::PropertyCallbackInfo &); + +static +void PropertyQueryCallbackWrapper( + v8::Local property + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyQueryIndex) + .As()->Value())); + callback(property, cbinfo); +} + +typedef void (*NativePropertyQuery) + (v8::Local, const v8::PropertyCallbackInfo &); +#endif + +static +void IndexGetterCallbackWrapper( + uint32_t index, const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyGetterIndex) + .As()->Value())); + callback(index, cbinfo); +} + +typedef void (*NativeIndexGetter) + (uint32_t, const v8::PropertyCallbackInfo &); + +static +void IndexSetterCallbackWrapper( + uint32_t index + , v8::Local value + , const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexSetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertySetterIndex) + .As()->Value())); + callback(index, value, cbinfo); +} + +typedef void (*NativeIndexSetter)( + uint32_t + , v8::Local + , const v8::PropertyCallbackInfo &); + +static +void IndexEnumeratorCallbackWrapper( + const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexEnumeratorCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField( + kIndexPropertyEnumeratorIndex).As()->Value())); + callback(cbinfo); +} + +typedef void (*NativeIndexEnumerator) + (const v8::PropertyCallbackInfo &); + +static +void IndexDeleterCallbackWrapper( + uint32_t index, const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyDeleterIndex) + .As()->Value())); + callback(index, cbinfo); +} + +typedef void (*NativeIndexDeleter) + (uint32_t, const v8::PropertyCallbackInfo &); + +static +void IndexQueryCallbackWrapper( + uint32_t index, const v8::PropertyCallbackInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyQueryIndex) + .As()->Value())); + callback(index, cbinfo); +} + +typedef void (*NativeIndexQuery) + (uint32_t, const v8::PropertyCallbackInfo &); +} // end of namespace imp + +#endif // NAN_CALLBACKS_12_INL_H_ diff --git a/node_modules/nan/nan_callbacks_pre_12_inl.h b/node_modules/nan/nan_callbacks_pre_12_inl.h new file mode 100644 index 00000000..c9ba4993 --- /dev/null +++ b/node_modules/nan/nan_callbacks_pre_12_inl.h @@ -0,0 +1,520 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CALLBACKS_PRE_12_INL_H_ +#define NAN_CALLBACKS_PRE_12_INL_H_ + +namespace imp { +template class ReturnValueImp; +} // end of namespace imp + +template +class ReturnValue { + v8::Isolate *isolate_; + v8::Persistent *value_; + friend class imp::ReturnValueImp; + + public: + template + explicit inline ReturnValue(v8::Isolate *isolate, v8::Persistent *p) : + isolate_(isolate), value_(p) {} + template + explicit inline ReturnValue(const ReturnValue& that) + : isolate_(that.isolate_), value_(that.value_) { + TYPE_CHECK(T, S); + } + + // Handle setters + template inline void Set(const v8::Local &handle) { + TYPE_CHECK(T, S); + value_->Dispose(); + *value_ = v8::Persistent::New(handle); + } + + template inline void Set(const Global &handle) { + TYPE_CHECK(T, S); + value_->Dispose(); + *value_ = v8::Persistent::New(handle.persistent); + const_cast &>(handle).Reset(); + } + + // Fast primitive setters + inline void Set(bool value) { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Boolean); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Boolean::New(value)); + } + + inline void Set(double i) { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Number); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Number::New(i)); + } + + inline void Set(int32_t i) { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Integer); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Int32::New(i)); + } + + inline void Set(uint32_t i) { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Integer); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Uint32::NewFromUnsigned(i)); + } + + // Fast JS primitive setters + inline void SetNull() { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Primitive); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Null()); + } + + inline void SetUndefined() { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::Primitive); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::Undefined()); + } + + inline void SetEmptyString() { + v8::HandleScope scope; + + TYPE_CHECK(T, v8::String); + value_->Dispose(); + *value_ = v8::Persistent::New(v8::String::Empty()); + } + + // Convenience getter for isolate + inline v8::Isolate *GetIsolate() const { + return isolate_; + } + + // Pointer setter: Uncompilable to prevent inadvertent misuse. + template + inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } +}; + +template +class FunctionCallbackInfo { + const v8::Arguments &args_; + v8::Local data_; + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline FunctionCallbackInfo( + const v8::Arguments &args + , v8::Local data) : + args_(args) + , data_(data) + , return_value_(args.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Undefined())) {} + + inline ~FunctionCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { + return ReturnValue(return_value_); + } + + inline v8::Local Callee() const { return args_.Callee(); } + inline v8::Local Data() const { return data_; } + inline v8::Local Holder() const { return args_.Holder(); } + inline bool IsConstructCall() const { return args_.IsConstructCall(); } + inline int Length() const { return args_.Length(); } + inline v8::Local operator[](int i) const { return args_[i]; } + inline v8::Local This() const { return args_.This(); } + inline v8::Isolate *GetIsolate() const { return args_.GetIsolate(); } + + + protected: + static const int kHolderIndex = 0; + static const int kIsolateIndex = 1; + static const int kReturnValueDefaultValueIndex = 2; + static const int kReturnValueIndex = 3; + static const int kDataIndex = 4; + static const int kCalleeIndex = 5; + static const int kContextSaveIndex = 6; + static const int kArgsLength = 7; + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) +}; + +template +class PropertyCallbackInfoBase { + const v8::AccessorInfo &info_; + const v8::Local data_; + + public: + explicit inline PropertyCallbackInfoBase( + const v8::AccessorInfo &info + , const v8::Local data) : + info_(info) + , data_(data) {} + + inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } + inline v8::Local Data() const { return data_; } + inline v8::Local This() const { return info_.This(); } + inline v8::Local Holder() const { return info_.Holder(); } + + protected: + static const int kHolderIndex = 0; + static const int kIsolateIndex = 1; + static const int kReturnValueDefaultValueIndex = 2; + static const int kReturnValueIndex = 3; + static const int kDataIndex = 4; + static const int kThisIndex = 5; + static const int kArgsLength = 6; + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfoBase) +}; + +template +class PropertyCallbackInfo : public PropertyCallbackInfoBase { + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline PropertyCallbackInfo( + const v8::AccessorInfo &info + , const v8::Local data) : + PropertyCallbackInfoBase(info, data) + , return_value_(info.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Undefined())) {} + + inline ~PropertyCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { return return_value_; } +}; + +template<> +class PropertyCallbackInfo : + public PropertyCallbackInfoBase { + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline PropertyCallbackInfo( + const v8::AccessorInfo &info + , const v8::Local data) : + PropertyCallbackInfoBase(info, data) + , return_value_(info.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Local())) {} + + inline ~PropertyCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { + return return_value_; + } +}; + +template<> +class PropertyCallbackInfo : + public PropertyCallbackInfoBase { + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline PropertyCallbackInfo( + const v8::AccessorInfo &info + , const v8::Local data) : + PropertyCallbackInfoBase(info, data) + , return_value_(info.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Local())) {} + + inline ~PropertyCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { + return return_value_; + } +}; + +template<> +class PropertyCallbackInfo : + public PropertyCallbackInfoBase { + ReturnValue return_value_; + v8::Persistent retval_; + + public: + explicit inline PropertyCallbackInfo( + const v8::AccessorInfo &info + , const v8::Local data) : + PropertyCallbackInfoBase(info, data) + , return_value_(info.GetIsolate(), &retval_) + , retval_(v8::Persistent::New(v8::Local())) {} + + inline ~PropertyCallbackInfo() { + retval_.Dispose(); + retval_.Clear(); + } + + inline ReturnValue GetReturnValue() const { + return return_value_; + } +}; + +namespace imp { +template +class ReturnValueImp : public ReturnValue { + public: + explicit ReturnValueImp(ReturnValue that) : + ReturnValue(that) {} + inline v8::Handle Value() { + return *ReturnValue::value_; + } +}; + +static +v8::Handle FunctionCallbackWrapper(const v8::Arguments &args) { + v8::Local obj = args.Data().As(); + FunctionCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kFunctionIndex).As()->Value())); + FunctionCallbackInfo + cbinfo(args, obj->GetInternalField(kDataIndex)); + callback(cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeFunction)(const v8::Arguments &); + +static +v8::Handle GetterCallbackWrapper( + v8::Local property, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + GetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kGetterIndex).As()->Value())); + callback(property, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeGetter) + (v8::Local, const v8::AccessorInfo &); + +static +void SetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + SetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kSetterIndex).As()->Value())); + callback(property, value, cbinfo); +} + +typedef void (*NativeSetter) + (v8::Local, v8::Local, const v8::AccessorInfo &); + +static +v8::Handle PropertyGetterCallbackWrapper( + v8::Local property, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyGetterIndex) + .As()->Value())); + callback(property, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativePropertyGetter) + (v8::Local, const v8::AccessorInfo &); + +static +v8::Handle PropertySetterCallbackWrapper( + v8::Local property + , v8::Local value + , const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertySetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertySetterIndex) + .As()->Value())); + callback(property, value, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativePropertySetter) + (v8::Local, v8::Local, const v8::AccessorInfo &); + +static +v8::Handle PropertyEnumeratorCallbackWrapper( + const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyEnumeratorCallback callback = + reinterpret_cast(reinterpret_cast( + obj->GetInternalField(kPropertyEnumeratorIndex) + .As()->Value())); + callback(cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativePropertyEnumerator) + (const v8::AccessorInfo &); + +static +v8::Handle PropertyDeleterCallbackWrapper( + v8::Local property + , const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyDeleterIndex) + .As()->Value())); + callback(property, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (NativePropertyDeleter) + (v8::Local, const v8::AccessorInfo &); + +static +v8::Handle PropertyQueryCallbackWrapper( + v8::Local property, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + PropertyQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kPropertyQueryIndex) + .As()->Value())); + callback(property, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativePropertyQuery) + (v8::Local, const v8::AccessorInfo &); + +static +v8::Handle IndexGetterCallbackWrapper( + uint32_t index, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexGetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyGetterIndex) + .As()->Value())); + callback(index, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexGetter) + (uint32_t, const v8::AccessorInfo &); + +static +v8::Handle IndexSetterCallbackWrapper( + uint32_t index + , v8::Local value + , const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexSetterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertySetterIndex) + .As()->Value())); + callback(index, value, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexSetter) + (uint32_t, v8::Local, const v8::AccessorInfo &); + +static +v8::Handle IndexEnumeratorCallbackWrapper( + const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexEnumeratorCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyEnumeratorIndex) + .As()->Value())); + callback(cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexEnumerator) + (const v8::AccessorInfo &); + +static +v8::Handle IndexDeleterCallbackWrapper( + uint32_t index, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexDeleterCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyDeleterIndex) + .As()->Value())); + callback(index, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexDeleter) + (uint32_t, const v8::AccessorInfo &); + +static +v8::Handle IndexQueryCallbackWrapper( + uint32_t index, const v8::AccessorInfo &info) { + v8::Local obj = info.Data().As(); + PropertyCallbackInfo + cbinfo(info, obj->GetInternalField(kDataIndex)); + IndexQueryCallback callback = reinterpret_cast( + reinterpret_cast( + obj->GetInternalField(kIndexPropertyQueryIndex) + .As()->Value())); + callback(index, cbinfo); + return ReturnValueImp(cbinfo.GetReturnValue()).Value(); +} + +typedef v8::Handle (*NativeIndexQuery) + (uint32_t, const v8::AccessorInfo &); +} // end of namespace imp + +#endif // NAN_CALLBACKS_PRE_12_INL_H_ diff --git a/node_modules/nan/nan_converters.h b/node_modules/nan/nan_converters.h new file mode 100644 index 00000000..c0b32729 --- /dev/null +++ b/node_modules/nan/nan_converters.h @@ -0,0 +1,72 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CONVERTERS_H_ +#define NAN_CONVERTERS_H_ + +namespace imp { +template struct ToFactoryBase { + typedef MaybeLocal return_t; +}; +template struct ValueFactoryBase { typedef Maybe return_t; }; + +template struct ToFactory; + +template<> +struct ToFactory : ToFactoryBase { + static inline return_t convert(v8::Local val) { + if (val.IsEmpty() || !val->IsFunction()) return MaybeLocal(); + return MaybeLocal(val.As()); + } +}; + +#define X(TYPE) \ + template<> \ + struct ToFactory : ToFactoryBase { \ + static inline return_t convert(v8::Local val); \ + }; + +X(Boolean) +X(Number) +X(String) +X(Object) +X(Integer) +X(Uint32) +X(Int32) + +#undef X + +#define X(TYPE) \ + template<> \ + struct ToFactory : ValueFactoryBase { \ + static inline return_t convert(v8::Local val); \ + }; + +X(bool) +X(double) +X(int64_t) +X(uint32_t) +X(int32_t) + +#undef X +} // end of namespace imp + +template +inline +typename imp::ToFactory::return_t To(v8::Local val) { + return imp::ToFactory::convert(val); +} + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +# include "nan_converters_43_inl.h" +#else +# include "nan_converters_pre_43_inl.h" +#endif + +#endif // NAN_CONVERTERS_H_ diff --git a/node_modules/nan/nan_converters_43_inl.h b/node_modules/nan/nan_converters_43_inl.h new file mode 100644 index 00000000..41b72deb --- /dev/null +++ b/node_modules/nan/nan_converters_43_inl.h @@ -0,0 +1,68 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CONVERTERS_43_INL_H_ +#define NAN_CONVERTERS_43_INL_H_ + +#define X(TYPE) \ +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ + v8::EscapableHandleScope scope(isolate); \ + return scope.Escape( \ + val->To ## TYPE(isolate->GetCurrentContext()) \ + .FromMaybe(v8::Local())); \ +} + +X(Number) +X(String) +X(Object) +X(Integer) +X(Uint32) +X(Int32) +// V8 <= 7.0 +#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) +X(Boolean) +#else +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ + v8::EscapableHandleScope scope(isolate); \ + return scope.Escape(val->ToBoolean(isolate)); \ +} +#endif + +#undef X + +#define X(TYPE, NAME) \ +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ + v8::HandleScope scope(isolate); \ + return val->NAME ## Value(isolate->GetCurrentContext()); \ +} + +X(double, Number) +X(int64_t, Integer) +X(uint32_t, Uint32) +X(int32_t, Int32) +// V8 <= 7.0 +#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) +X(bool, Boolean) +#else +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ + v8::HandleScope scope(isolate); \ + return Just(val->BooleanValue(isolate)); \ +} +#endif + +#undef X + +#endif // NAN_CONVERTERS_43_INL_H_ diff --git a/node_modules/nan/nan_converters_pre_43_inl.h b/node_modules/nan/nan_converters_pre_43_inl.h new file mode 100644 index 00000000..ae0518aa --- /dev/null +++ b/node_modules/nan/nan_converters_pre_43_inl.h @@ -0,0 +1,42 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_CONVERTERS_PRE_43_INL_H_ +#define NAN_CONVERTERS_PRE_43_INL_H_ + +#define X(TYPE) \ +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + return val->To ## TYPE(); \ +} + +X(Boolean) +X(Number) +X(String) +X(Object) +X(Integer) +X(Uint32) +X(Int32) + +#undef X + +#define X(TYPE, NAME) \ +imp::ToFactory::return_t \ +imp::ToFactory::convert(v8::Local val) { \ + return Just(val->NAME ## Value()); \ +} + +X(bool, Boolean) +X(double, Number) +X(int64_t, Integer) +X(uint32_t, Uint32) +X(int32_t, Int32) + +#undef X + +#endif // NAN_CONVERTERS_PRE_43_INL_H_ diff --git a/node_modules/nan/nan_define_own_property_helper.h b/node_modules/nan/nan_define_own_property_helper.h new file mode 100644 index 00000000..d710ef22 --- /dev/null +++ b/node_modules/nan/nan_define_own_property_helper.h @@ -0,0 +1,29 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_ +#define NAN_DEFINE_OWN_PROPERTY_HELPER_H_ + +namespace imp { + +inline Maybe DefineOwnPropertyHelper( + v8::PropertyAttribute current + , v8::Handle obj + , v8::Handle key + , v8::Handle value + , v8::PropertyAttribute attribs = v8::None) { + return !(current & v8::DontDelete) || // configurable OR + (!(current & v8::ReadOnly) && // writable AND + !((attribs ^ current) & ~v8::ReadOnly)) // same excluding RO + ? Just(obj->ForceSet(key, value, attribs)) + : Nothing(); +} + +} // end of namespace imp + +#endif // NAN_DEFINE_OWN_PROPERTY_HELPER_H_ diff --git a/node_modules/nan/nan_implementation_12_inl.h b/node_modules/nan/nan_implementation_12_inl.h new file mode 100644 index 00000000..255293ac --- /dev/null +++ b/node_modules/nan/nan_implementation_12_inl.h @@ -0,0 +1,430 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_12_INL_H_ +#define NAN_IMPLEMENTATION_12_INL_H_ +//============================================================================== +// node v0.11 implementation +//============================================================================== + +namespace imp { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(v8::Isolate::GetCurrent()); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(v8::Isolate::GetCurrent(), length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(v8::Isolate::GetCurrent(), value); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { +#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) + return v8::BooleanObject::New( + v8::Isolate::GetCurrent(), value).As(); +#else + return v8::BooleanObject::New(value).As(); +#endif +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Local tmpl + , v8::Local obj) { + return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); +} + +//=== Date ===================================================================== + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New(double value) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(v8::Date::New(isolate->GetCurrentContext(), value) + .FromMaybe(v8::Local()).As()); +} +#else +Factory::return_t +Factory::New(double value) { + return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); +} +#endif + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(v8::Isolate::GetCurrent(), value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( FunctionCallback callback + , v8::Local data) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::Local tpl = v8::ObjectTemplate::New(isolate); + tpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = NewInstance(tpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kFunctionIndex + , v8::External::New(isolate, reinterpret_cast(callback))); + + v8::Local val = v8::Local::New(isolate, data); + + if (!val.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, val); + } + +#if NODE_MAJOR_VERSION >= 10 + v8::Local context = isolate->GetCurrentContext(); + v8::Local function = + v8::Function::New(context, imp::FunctionCallbackWrapper, obj) + .ToLocalChecked(); +#else + v8::Local function = + v8::Function::New(isolate, imp::FunctionCallbackWrapper, obj); +#endif + + return scope.Escape(function); +} + +//=== Function Template ======================================================== + +Factory::return_t +Factory::New( FunctionCallback callback + , v8::Local data + , v8::Local signature) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + if (callback) { + v8::EscapableHandleScope scope(isolate); + v8::Local tpl = v8::ObjectTemplate::New(isolate); + tpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = NewInstance(tpl).ToLocalChecked(); + + obj->SetInternalField( + imp::kFunctionIndex + , v8::External::New(isolate, reinterpret_cast(callback))); + v8::Local val = v8::Local::New(isolate, data); + + if (!val.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, val); + } + + return scope.Escape(v8::FunctionTemplate::New( isolate + , imp::FunctionCallbackWrapper + , obj + , signature)); + } else { + return v8::FunctionTemplate::New(isolate, 0, data, signature); + } +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(v8::Isolate::GetCurrent(), value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New( v8::Isolate::GetCurrent() + , value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(v8::Isolate::GetCurrent(), value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To( + v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); +} + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(v8::Isolate::GetCurrent()); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); +} + +//=== RegExp =================================================================== + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New( + v8::Local pattern + , v8::RegExp::Flags flags) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + v8::RegExp::New(isolate->GetCurrentContext(), pattern, flags) + .FromMaybe(v8::Local())); +} +#else +Factory::return_t +Factory::New( + v8::Local pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} +#endif + +//=== Script =================================================================== + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New( v8::Local source) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::ScriptCompiler::Source src(source); + return scope.Escape( + v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) + .FromMaybe(v8::Local())); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::ScriptCompiler::Source src(source, origin); + return scope.Escape( + v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) + .FromMaybe(v8::Local())); +} +#else +Factory::return_t +Factory::New( v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); +} +#endif + +//=== Signature ================================================================ + +Factory::return_t +Factory::New(Factory::FTH receiver) { + return v8::Signature::New(v8::Isolate::GetCurrent(), receiver); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(v8::Isolate::GetCurrent()); +} + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::NewFromUtf8( + v8::Isolate::GetCurrent(), value, v8::NewStringType::kNormal, length); +} + +Factory::return_t +Factory::New(std::string const& value) { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), + value.data(), v8::NewStringType::kNormal, static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, + v8::NewStringType::kNormal, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternalTwoByte(v8::Isolate::GetCurrent(), value); +} + +Factory::return_t +Factory::New(ExternalOneByteStringResource * value) { + return v8::String::NewExternalOneByte(v8::Isolate::GetCurrent(), value); +} +#else +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New( + std::string const& value) /* NOLINT(build/include_what_you_use) */ { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value.data(), + v8::String::kNormalString, + static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, + v8::String::kNormalString, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} + +Factory::return_t +Factory::New(ExternalOneByteStringResource * value) { + return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); +} +#endif + +//=== String Object ============================================================ + +// See https://github.com/nodejs/nan/pull/811#discussion_r224594980. +// Disable the warning as there is no way around it. +// TODO(bnoordhuis) Use isolate-based version in Node.js v12. +Factory::return_t +Factory::New(v8::Local value) { +// V8 > 7.0 +#if V8_MAJOR_VERSION > 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION > 0) + return v8::StringObject::New(v8::Isolate::GetCurrent(), value) + .As(); +#else +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4996) +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + return v8::StringObject::New(value).As(); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#endif +} + +//=== Unbound Script =========================================================== + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +Factory::return_t +Factory::New(v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::CompileUnboundScript( + v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::CompileUnboundScript( + v8::Isolate::GetCurrent(), &src); +} +#else +Factory::return_t +Factory::New(v8::Local source) { + v8::ScriptCompiler::Source src(source); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} + +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + v8::ScriptCompiler::Source src(source, origin); + return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); +} +#endif + +} // end of namespace imp + +//=== Presistents and Handles ================================================== + +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION +template +inline v8::Local New(v8::Handle h) { + return v8::Local::New(v8::Isolate::GetCurrent(), h); +} +#endif + +template +inline v8::Local New(v8::Persistent const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +template +inline v8::Local New(Persistent const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +template +inline v8::Local New(Global const& p) { + return v8::Local::New(v8::Isolate::GetCurrent(), p); +} + +#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/node_modules/nan/nan_implementation_pre_12_inl.h b/node_modules/nan/nan_implementation_pre_12_inl.h new file mode 100644 index 00000000..1472421a --- /dev/null +++ b/node_modules/nan/nan_implementation_pre_12_inl.h @@ -0,0 +1,263 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ +#define NAN_IMPLEMENTATION_PRE_12_INL_H_ + +//============================================================================== +// node v0.10 implementation +//============================================================================== + +namespace imp { + +//=== Array ==================================================================== + +Factory::return_t +Factory::New() { + return v8::Array::New(); +} + +Factory::return_t +Factory::New(int length) { + return v8::Array::New(length); +} + +//=== Boolean ================================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::Boolean::New(value)->ToBoolean(); +} + +//=== Boolean Object =========================================================== + +Factory::return_t +Factory::New(bool value) { + return v8::BooleanObject::New(value).As(); +} + +//=== Context ================================================================== + +Factory::return_t +Factory::New( v8::ExtensionConfiguration* extensions + , v8::Local tmpl + , v8::Local obj) { + v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); + v8::Local lctx = v8::Local::New(ctx); + ctx.Dispose(); + return lctx; +} + +//=== Date ===================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Date::New(value).As(); +} + +//=== External ================================================================= + +Factory::return_t +Factory::New(void * value) { + return v8::External::New(value); +} + +//=== Function ================================================================= + +Factory::return_t +Factory::New( FunctionCallback callback + , v8::Local data) { + v8::HandleScope scope; + + return scope.Close(Factory::New( + callback, data, v8::Local()) + ->GetFunction()); +} + + +//=== FunctionTemplate ========================================================= + +Factory::return_t +Factory::New( FunctionCallback callback + , v8::Local data + , v8::Local signature) { + if (callback) { + v8::HandleScope scope; + + v8::Local tpl = v8::ObjectTemplate::New(); + tpl->SetInternalFieldCount(imp::kFunctionFieldCount); + v8::Local obj = tpl->NewInstance(); + + obj->SetInternalField( + imp::kFunctionIndex + , v8::External::New(reinterpret_cast(callback))); + + v8::Local val = v8::Local::New(data); + + if (!val.IsEmpty()) { + obj->SetInternalField(imp::kDataIndex, val); + } + + // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find + // a way. Have at it though... + return scope.Close( + v8::FunctionTemplate::New(imp::FunctionCallbackWrapper + , obj + , signature)); + } else { + return v8::FunctionTemplate::New(0, data, signature); + } +} + +//=== Number =================================================================== + +Factory::return_t +Factory::New(double value) { + return v8::Number::New(value); +} + +//=== Number Object ============================================================ + +Factory::return_t +Factory::New(double value) { + return v8::NumberObject::New(value).As(); +} + +//=== Integer, Int32 and Uint32 ================================================ + +template +typename IntegerFactory::return_t +IntegerFactory::New(int32_t value) { + return To(T::New(value)); +} + +template +typename IntegerFactory::return_t +IntegerFactory::New(uint32_t value) { + return To(T::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(int32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + +Factory::return_t +Factory::New(uint32_t value) { + return To(v8::Uint32::NewFromUnsigned(value)); +} + + +//=== Object =================================================================== + +Factory::return_t +Factory::New() { + return v8::Object::New(); +} + +//=== Object Template ========================================================== + +Factory::return_t +Factory::New() { + return v8::ObjectTemplate::New(); +} + +//=== RegExp =================================================================== + +Factory::return_t +Factory::New( + v8::Local pattern + , v8::RegExp::Flags flags) { + return v8::RegExp::New(pattern, flags); +} + +//=== Script =================================================================== + +Factory::return_t +Factory::New( v8::Local source) { + return v8::Script::New(source); +} +Factory::return_t +Factory::New( v8::Local source + , v8::ScriptOrigin const& origin) { + return v8::Script::New(source, const_cast(&origin)); +} + +//=== Signature ================================================================ + +Factory::return_t +Factory::New(Factory::FTH receiver) { + return v8::Signature::New(receiver); +} + +//=== String =================================================================== + +Factory::return_t +Factory::New() { + return v8::String::Empty(); +} + +Factory::return_t +Factory::New(const char * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New( + std::string const& value) /* NOLINT(build/include_what_you_use) */ { + assert(value.size() <= INT_MAX && "string too long"); + return v8::String::New(value.data(), static_cast(value.size())); +} + +Factory::return_t +Factory::New(const uint16_t * value, int length) { + return v8::String::New(value, length); +} + +Factory::return_t +Factory::New(v8::String::ExternalStringResource * value) { + return v8::String::NewExternal(value); +} + +Factory::return_t +Factory::New(v8::String::ExternalAsciiStringResource * value) { + return v8::String::NewExternal(value); +} + +//=== String Object ============================================================ + +Factory::return_t +Factory::New(v8::Local value) { + return v8::StringObject::New(value).As(); +} + +} // end of namespace imp + +//=== Presistents and Handles ================================================== + +template +inline v8::Local New(v8::Handle h) { + return v8::Local::New(h); +} + +template +inline v8::Local New(v8::Persistent const& p) { + return v8::Local::New(p); +} + +template +inline v8::Local New(Persistent const& p) { + return v8::Local::New(p.persistent); +} + +template +inline v8::Local New(Global const& p) { + return v8::Local::New(p.persistent); +} + +#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/node_modules/nan/nan_json.h b/node_modules/nan/nan_json.h new file mode 100644 index 00000000..33ac8ba6 --- /dev/null +++ b/node_modules/nan/nan_json.h @@ -0,0 +1,166 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_JSON_H_ +#define NAN_JSON_H_ + +#if NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION +#define NAN_JSON_H_NEED_PARSE 1 +#else +#define NAN_JSON_H_NEED_PARSE 0 +#endif // NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION + +#if NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION +#define NAN_JSON_H_NEED_STRINGIFY 0 +#else +#define NAN_JSON_H_NEED_STRINGIFY 1 +#endif // NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION + +class JSON { + public: + JSON() { +#if NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY + Nan::HandleScope scope; + + Nan::MaybeLocal maybe_global_json = Nan::Get( + Nan::GetCurrentContext()->Global(), + Nan::New("JSON").ToLocalChecked() + ); + + assert(!maybe_global_json.IsEmpty() && "global JSON is empty"); + v8::Local val_global_json = maybe_global_json.ToLocalChecked(); + + assert(val_global_json->IsObject() && "global JSON is not an object"); + Nan::MaybeLocal maybe_obj_global_json = + Nan::To(val_global_json); + + assert(!maybe_obj_global_json.IsEmpty() && "global JSON object is empty"); + v8::Local global_json = maybe_obj_global_json.ToLocalChecked(); + +#if NAN_JSON_H_NEED_PARSE + Nan::MaybeLocal maybe_parse_method = Nan::Get( + global_json, Nan::New("parse").ToLocalChecked() + ); + + assert(!maybe_parse_method.IsEmpty() && "JSON.parse is empty"); + v8::Local parse_method = maybe_parse_method.ToLocalChecked(); + + assert(parse_method->IsFunction() && "JSON.parse is not a function"); + parse_cb_.Reset(parse_method.As()); +#endif // NAN_JSON_H_NEED_PARSE + +#if NAN_JSON_H_NEED_STRINGIFY + Nan::MaybeLocal maybe_stringify_method = Nan::Get( + global_json, Nan::New("stringify").ToLocalChecked() + ); + + assert(!maybe_stringify_method.IsEmpty() && "JSON.stringify is empty"); + v8::Local stringify_method = + maybe_stringify_method.ToLocalChecked(); + + assert( + stringify_method->IsFunction() && "JSON.stringify is not a function" + ); + stringify_cb_.Reset(stringify_method.As()); +#endif // NAN_JSON_H_NEED_STRINGIFY +#endif // NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY + } + + inline + Nan::MaybeLocal Parse(v8::Local json_string) { + Nan::EscapableHandleScope scope; +#if NAN_JSON_H_NEED_PARSE + return scope.Escape(parse(json_string)); +#else + Nan::MaybeLocal result; +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && \ + NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION + result = v8::JSON::Parse(json_string); +#else +#if NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION + v8::Local context_or_isolate = Nan::GetCurrentContext(); +#else + v8::Isolate* context_or_isolate = v8::Isolate::GetCurrent(); +#endif // NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION + result = v8::JSON::Parse(context_or_isolate, json_string); +#endif // NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && + // NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION + if (result.IsEmpty()) return v8::Local(); + return scope.Escape(result.ToLocalChecked()); +#endif // NAN_JSON_H_NEED_PARSE + } + + inline + Nan::MaybeLocal Stringify(v8::Local json_object) { + Nan::EscapableHandleScope scope; + Nan::MaybeLocal result = +#if NAN_JSON_H_NEED_STRINGIFY + Nan::To(stringify(json_object)); +#else + v8::JSON::Stringify(Nan::GetCurrentContext(), json_object); +#endif // NAN_JSON_H_NEED_STRINGIFY + if (result.IsEmpty()) return v8::Local(); + return scope.Escape(result.ToLocalChecked()); + } + + inline + Nan::MaybeLocal Stringify(v8::Local json_object, + v8::Local gap) { + Nan::EscapableHandleScope scope; + Nan::MaybeLocal result = +#if NAN_JSON_H_NEED_STRINGIFY + Nan::To(stringify(json_object, gap)); +#else + v8::JSON::Stringify(Nan::GetCurrentContext(), json_object, gap); +#endif // NAN_JSON_H_NEED_STRINGIFY + if (result.IsEmpty()) return v8::Local(); + return scope.Escape(result.ToLocalChecked()); + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(JSON) +#if NAN_JSON_H_NEED_PARSE + Nan::Callback parse_cb_; +#endif // NAN_JSON_H_NEED_PARSE +#if NAN_JSON_H_NEED_STRINGIFY + Nan::Callback stringify_cb_; +#endif // NAN_JSON_H_NEED_STRINGIFY + +#if NAN_JSON_H_NEED_PARSE + inline v8::Local parse(v8::Local arg) { + assert(!parse_cb_.IsEmpty() && "parse_cb_ is empty"); + AsyncResource resource("nan:JSON.parse"); + return parse_cb_.Call(1, &arg, &resource).FromMaybe(v8::Local()); + } +#endif // NAN_JSON_H_NEED_PARSE + +#if NAN_JSON_H_NEED_STRINGIFY + inline v8::Local stringify(v8::Local arg) { + assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); + AsyncResource resource("nan:JSON.stringify"); + return stringify_cb_.Call(1, &arg, &resource) + .FromMaybe(v8::Local()); + } + + inline v8::Local stringify(v8::Local arg, + v8::Local gap) { + assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); + + v8::Local argv[] = { + arg, + Nan::Null(), + gap + }; + AsyncResource resource("nan:JSON.stringify"); + return stringify_cb_.Call(3, argv, &resource) + .FromMaybe(v8::Local()); + } +#endif // NAN_JSON_H_NEED_STRINGIFY +}; + +#endif // NAN_JSON_H_ diff --git a/node_modules/nan/nan_maybe_43_inl.h b/node_modules/nan/nan_maybe_43_inl.h new file mode 100644 index 00000000..c04ce30d --- /dev/null +++ b/node_modules/nan/nan_maybe_43_inl.h @@ -0,0 +1,356 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_MAYBE_43_INL_H_ +#define NAN_MAYBE_43_INL_H_ + +template +using MaybeLocal = v8::MaybeLocal; + +inline +MaybeLocal ToDetailString(v8::Local val) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(val->ToDetailString(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal ToArrayIndex(v8::Local val) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(val->ToArrayIndex(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline +Maybe Equals(v8::Local a, v8::Local(b)) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return a->Equals(isolate->GetCurrentContext(), b); +} + +inline +MaybeLocal NewInstance(v8::Local h) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal NewInstance( + v8::Local h + , int argc + , v8::Local argv[]) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(h->NewInstance(isolate->GetCurrentContext(), argc, argv) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal NewInstance(v8::Local h) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + + +inline MaybeLocal GetFunction( + v8::Local t) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(t->GetFunction(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline Maybe Set( + v8::Local obj + , v8::Local key + , v8::Local value) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Set(isolate->GetCurrentContext(), key, value); +} + +inline Maybe Set( + v8::Local obj + , uint32_t index + , v8::Local value) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Set(isolate->GetCurrentContext(), index, value); +} + +#if NODE_MODULE_VERSION < NODE_4_0_MODULE_VERSION +#include "nan_define_own_property_helper.h" // NOLINT(build/include) +#endif + +inline Maybe DefineOwnProperty( + v8::Local obj + , v8::Local key + , v8::Local value + , v8::PropertyAttribute attribs = v8::None) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); +#if NODE_MODULE_VERSION >= NODE_4_0_MODULE_VERSION + return obj->DefineOwnProperty(isolate->GetCurrentContext(), key, value, + attribs); +#else + Maybe maybeCurrent = + obj->GetPropertyAttributes(isolate->GetCurrentContext(), key); + if (maybeCurrent.IsNothing()) { + return Nothing(); + } + v8::PropertyAttribute current = maybeCurrent.FromJust(); + return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); +#endif +} + +NAN_DEPRECATED inline Maybe ForceSet( + v8::Local obj + , v8::Local key + , v8::Local value + , v8::PropertyAttribute attribs = v8::None) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); +#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION + return key->IsName() + ? obj->DefineOwnProperty(isolate->GetCurrentContext(), + key.As(), value, attribs) + : Nothing(); +#else + return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs); +#endif +} + +inline MaybeLocal Get( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->Get(isolate->GetCurrentContext(), key) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal Get(v8::Local obj, uint32_t index) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->Get(isolate->GetCurrentContext(), index) + .FromMaybe(v8::Local())); +} + +inline v8::PropertyAttribute GetPropertyAttributes( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->GetPropertyAttributes(isolate->GetCurrentContext(), key) + .FromJust(); +} + +inline Maybe Has( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Has(isolate->GetCurrentContext(), key); +} + +inline Maybe Has(v8::Local obj, uint32_t index) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Has(isolate->GetCurrentContext(), index); +} + +inline Maybe Delete( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Delete(isolate->GetCurrentContext(), key); +} + +inline +Maybe Delete(v8::Local obj, uint32_t index) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->Delete(isolate->GetCurrentContext(), index); +} + +inline +MaybeLocal GetPropertyNames(v8::Local obj) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->GetPropertyNames(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal GetOwnPropertyNames(v8::Local obj) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->GetOwnPropertyNames(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline Maybe SetPrototype( + v8::Local obj + , v8::Local prototype) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->SetPrototype(isolate->GetCurrentContext(), prototype); +} + +inline MaybeLocal ObjectProtoToString( + v8::Local obj) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->ObjectProtoToString(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline Maybe HasOwnProperty( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->HasOwnProperty(isolate->GetCurrentContext(), key); +} + +inline Maybe HasRealNamedProperty( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->HasRealNamedProperty(isolate->GetCurrentContext(), key); +} + +inline Maybe HasRealIndexedProperty( + v8::Local obj + , uint32_t index) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->HasRealIndexedProperty(isolate->GetCurrentContext(), index); +} + +inline Maybe HasRealNamedCallbackProperty( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return obj->HasRealNamedCallbackProperty(isolate->GetCurrentContext(), key); +} + +inline MaybeLocal GetRealNamedPropertyInPrototypeChain( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(obj->GetRealNamedPropertyInPrototypeChain( + isolate->GetCurrentContext(), key) + .FromMaybe(v8::Local())); +} + +inline MaybeLocal GetRealNamedProperty( + v8::Local obj + , v8::Local key) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + obj->GetRealNamedProperty(isolate->GetCurrentContext(), key) + .FromMaybe(v8::Local())); +} + +inline MaybeLocal CallAsFunction( + v8::Local obj + , v8::Local recv + , int argc + , v8::Local argv[]) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + obj->CallAsFunction(isolate->GetCurrentContext(), recv, argc, argv) + .FromMaybe(v8::Local())); +} + +inline MaybeLocal CallAsConstructor( + v8::Local obj + , int argc, v8::Local argv[]) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape( + obj->CallAsConstructor(isolate->GetCurrentContext(), argc, argv) + .FromMaybe(v8::Local())); +} + +inline +MaybeLocal GetSourceLine(v8::Local msg) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(msg->GetSourceLine(isolate->GetCurrentContext()) + .FromMaybe(v8::Local())); +} + +inline Maybe GetLineNumber(v8::Local msg) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return msg->GetLineNumber(isolate->GetCurrentContext()); +} + +inline Maybe GetStartColumn(v8::Local msg) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return msg->GetStartColumn(isolate->GetCurrentContext()); +} + +inline Maybe GetEndColumn(v8::Local msg) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); + return msg->GetEndColumn(isolate->GetCurrentContext()); +} + +inline MaybeLocal CloneElementAt( + v8::Local array + , uint32_t index) { +#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::Local context = isolate->GetCurrentContext(); + v8::Local elem; + v8::Local obj; + if (!array->Get(context, index).ToLocal(&elem)) { + return scope.Escape(obj); + } + if (!elem->ToObject(context).ToLocal(&obj)) { + return scope.Escape(v8::Local()); + } + return scope.Escape(obj->Clone()); +#else + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(array->CloneElementAt(isolate->GetCurrentContext(), index) + .FromMaybe(v8::Local())); +#endif +} + +inline MaybeLocal Call( + v8::Local fun + , v8::Local recv + , int argc + , v8::Local argv[]) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + return scope.Escape(fun->Call(isolate->GetCurrentContext(), recv, argc, argv) + .FromMaybe(v8::Local())); +} + +#endif // NAN_MAYBE_43_INL_H_ diff --git a/node_modules/nan/nan_maybe_pre_43_inl.h b/node_modules/nan/nan_maybe_pre_43_inl.h new file mode 100644 index 00000000..83325ae0 --- /dev/null +++ b/node_modules/nan/nan_maybe_pre_43_inl.h @@ -0,0 +1,268 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_MAYBE_PRE_43_INL_H_ +#define NAN_MAYBE_PRE_43_INL_H_ + +template +class MaybeLocal { + public: + inline MaybeLocal() : val_(v8::Local()) {} + + template +# if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION + inline + MaybeLocal(v8::Local that) : val_(that) {} // NOLINT(runtime/explicit) +# else + inline + MaybeLocal(v8::Local that) : // NOLINT(runtime/explicit) + val_(*reinterpret_cast*>(&that)) {} +# endif + + inline bool IsEmpty() const { return val_.IsEmpty(); } + + template + inline bool ToLocal(v8::Local *out) const { + *out = val_; + return !IsEmpty(); + } + + inline v8::Local ToLocalChecked() const { +#if defined(V8_ENABLE_CHECKS) + assert(!IsEmpty() && "ToLocalChecked is Empty"); +#endif // V8_ENABLE_CHECKS + return val_; + } + + template + inline v8::Local FromMaybe(v8::Local default_value) const { + return IsEmpty() ? default_value : v8::Local(val_); + } + + private: + v8::Local val_; +}; + +inline +MaybeLocal ToDetailString(v8::Handle val) { + return MaybeLocal(val->ToDetailString()); +} + +inline +MaybeLocal ToArrayIndex(v8::Handle val) { + return MaybeLocal(val->ToArrayIndex()); +} + +inline +Maybe Equals(v8::Handle a, v8::Handle(b)) { + return Just(a->Equals(b)); +} + +inline +MaybeLocal NewInstance(v8::Handle h) { + return MaybeLocal(h->NewInstance()); +} + +inline +MaybeLocal NewInstance( + v8::Local h + , int argc + , v8::Local argv[]) { + return MaybeLocal(h->NewInstance(argc, argv)); +} + +inline +MaybeLocal NewInstance(v8::Handle h) { + return MaybeLocal(h->NewInstance()); +} + +inline +MaybeLocal GetFunction(v8::Handle t) { + return MaybeLocal(t->GetFunction()); +} + +inline Maybe Set( + v8::Handle obj + , v8::Handle key + , v8::Handle value) { + return Just(obj->Set(key, value)); +} + +inline Maybe Set( + v8::Handle obj + , uint32_t index + , v8::Handle value) { + return Just(obj->Set(index, value)); +} + +#include "nan_define_own_property_helper.h" // NOLINT(build/include) + +inline Maybe DefineOwnProperty( + v8::Handle obj + , v8::Handle key + , v8::Handle value + , v8::PropertyAttribute attribs = v8::None) { + v8::PropertyAttribute current = obj->GetPropertyAttributes(key); + return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); +} + +NAN_DEPRECATED inline Maybe ForceSet( + v8::Handle obj + , v8::Handle key + , v8::Handle value + , v8::PropertyAttribute attribs = v8::None) { + return Just(obj->ForceSet(key, value, attribs)); +} + +inline MaybeLocal Get( + v8::Handle obj + , v8::Handle key) { + return MaybeLocal(obj->Get(key)); +} + +inline MaybeLocal Get( + v8::Handle obj + , uint32_t index) { + return MaybeLocal(obj->Get(index)); +} + +inline Maybe GetPropertyAttributes( + v8::Handle obj + , v8::Handle key) { + return Just(obj->GetPropertyAttributes(key)); +} + +inline Maybe Has( + v8::Handle obj + , v8::Handle key) { + return Just(obj->Has(key)); +} + +inline Maybe Has( + v8::Handle obj + , uint32_t index) { + return Just(obj->Has(index)); +} + +inline Maybe Delete( + v8::Handle obj + , v8::Handle key) { + return Just(obj->Delete(key)); +} + +inline Maybe Delete( + v8::Handle obj + , uint32_t index) { + return Just(obj->Delete(index)); +} + +inline +MaybeLocal GetPropertyNames(v8::Handle obj) { + return MaybeLocal(obj->GetPropertyNames()); +} + +inline +MaybeLocal GetOwnPropertyNames(v8::Handle obj) { + return MaybeLocal(obj->GetOwnPropertyNames()); +} + +inline Maybe SetPrototype( + v8::Handle obj + , v8::Handle prototype) { + return Just(obj->SetPrototype(prototype)); +} + +inline MaybeLocal ObjectProtoToString( + v8::Handle obj) { + return MaybeLocal(obj->ObjectProtoToString()); +} + +inline Maybe HasOwnProperty( + v8::Handle obj + , v8::Handle key) { + return Just(obj->HasOwnProperty(key)); +} + +inline Maybe HasRealNamedProperty( + v8::Handle obj + , v8::Handle key) { + return Just(obj->HasRealNamedProperty(key)); +} + +inline Maybe HasRealIndexedProperty( + v8::Handle obj + , uint32_t index) { + return Just(obj->HasRealIndexedProperty(index)); +} + +inline Maybe HasRealNamedCallbackProperty( + v8::Handle obj + , v8::Handle key) { + return Just(obj->HasRealNamedCallbackProperty(key)); +} + +inline MaybeLocal GetRealNamedPropertyInPrototypeChain( + v8::Handle obj + , v8::Handle key) { + return MaybeLocal( + obj->GetRealNamedPropertyInPrototypeChain(key)); +} + +inline MaybeLocal GetRealNamedProperty( + v8::Handle obj + , v8::Handle key) { + return MaybeLocal(obj->GetRealNamedProperty(key)); +} + +inline MaybeLocal CallAsFunction( + v8::Handle obj + , v8::Handle recv + , int argc + , v8::Handle argv[]) { + return MaybeLocal(obj->CallAsFunction(recv, argc, argv)); +} + +inline MaybeLocal CallAsConstructor( + v8::Handle obj + , int argc + , v8::Local argv[]) { + return MaybeLocal(obj->CallAsConstructor(argc, argv)); +} + +inline +MaybeLocal GetSourceLine(v8::Handle msg) { + return MaybeLocal(msg->GetSourceLine()); +} + +inline Maybe GetLineNumber(v8::Handle msg) { + return Just(msg->GetLineNumber()); +} + +inline Maybe GetStartColumn(v8::Handle msg) { + return Just(msg->GetStartColumn()); +} + +inline Maybe GetEndColumn(v8::Handle msg) { + return Just(msg->GetEndColumn()); +} + +inline MaybeLocal CloneElementAt( + v8::Handle array + , uint32_t index) { + return MaybeLocal(array->CloneElementAt(index)); +} + +inline MaybeLocal Call( + v8::Local fun + , v8::Local recv + , int argc + , v8::Local argv[]) { + return MaybeLocal(fun->Call(recv, argc, argv)); +} + +#endif // NAN_MAYBE_PRE_43_INL_H_ diff --git a/node_modules/nan/nan_new.h b/node_modules/nan/nan_new.h new file mode 100644 index 00000000..cdf8bbe4 --- /dev/null +++ b/node_modules/nan/nan_new.h @@ -0,0 +1,340 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_NEW_H_ +#define NAN_NEW_H_ + +namespace imp { // scnr + +// TODO(agnat): Generalize +template v8::Local To(v8::Local i); + +template <> +inline +v8::Local +To(v8::Local i) { + return Nan::To(i).ToLocalChecked(); +} + +template <> +inline +v8::Local +To(v8::Local i) { + return Nan::To(i).ToLocalChecked(); +} + +template <> +inline +v8::Local +To(v8::Local i) { + return Nan::To(i).ToLocalChecked(); +} + +template struct FactoryBase { + typedef v8::Local return_t; +}; + +template struct MaybeFactoryBase { + typedef MaybeLocal return_t; +}; + +template struct Factory; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); + static inline return_t New(int length); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(bool value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( v8::ExtensionConfiguration* extensions = NULL + , v8::Local tmpl = v8::Local() + , v8::Local obj = v8::Local()); +}; + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(void *value); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( FunctionCallback callback + , v8::Local data = v8::Local()); +}; + +template <> +struct Factory : FactoryBase { + static inline + return_t + New( FunctionCallback callback = NULL + , v8::Local data = v8::Local() + , v8::Local signature = v8::Local()); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(double value); +}; + +template +struct IntegerFactory : FactoryBase { + typedef typename FactoryBase::return_t return_t; + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : IntegerFactory {}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(int32_t value); + static inline return_t New(uint32_t value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(); +}; + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New( + v8::Local pattern, v8::RegExp::Flags flags); +}; + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +template <> +struct Factory : FactoryBase { + typedef v8::Local FTH; + static inline return_t New(FTH receiver = FTH()); +}; + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New(); + static inline return_t New(const char *value, int length = -1); + static inline return_t New(const uint16_t *value, int length = -1); + static inline return_t New(std::string const& value); + + static inline return_t New(v8::String::ExternalStringResource * value); + static inline return_t New(ExternalOneByteStringResource * value); +}; + +template <> +struct Factory : FactoryBase { + static inline return_t New(v8::Local value); +}; + +} // end of namespace imp + +#if (NODE_MODULE_VERSION >= 12) + +namespace imp { + +template <> +struct Factory : MaybeFactoryBase { + static inline return_t New( v8::Local source); + static inline return_t New( v8::Local source + , v8::ScriptOrigin const& origin); +}; + +} // end of namespace imp + +# include "nan_implementation_12_inl.h" + +#else // NODE_MODULE_VERSION >= 12 + +# include "nan_implementation_pre_12_inl.h" + +#endif + +//=== API ====================================================================== + +template +typename imp::Factory::return_t +New() { + return imp::Factory::New(); +} + +template +typename imp::Factory::return_t +New(A0 arg0) { + return imp::Factory::New(arg0); +} + +template +typename imp::Factory::return_t +New(A0 arg0, A1 arg1) { + return imp::Factory::New(arg0, arg1); +} + +template +typename imp::Factory::return_t +New(A0 arg0, A1 arg1, A2 arg2) { + return imp::Factory::New(arg0, arg1, arg2); +} + +template +typename imp::Factory::return_t +New(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { + return imp::Factory::New(arg0, arg1, arg2, arg3); +} + +// Note(agnat): When passing overloaded function pointers to template functions +// as generic arguments the compiler needs help in picking the right overload. +// These two functions handle New and New with +// all argument variations. + +// v8::Function and v8::FunctionTemplate with one or two arguments +template +typename imp::Factory::return_t +New( FunctionCallback callback + , v8::Local data = v8::Local()) { + return imp::Factory::New(callback, data); +} + +// v8::Function and v8::FunctionTemplate with three arguments +template +typename imp::Factory::return_t +New( FunctionCallback callback + , v8::Local data = v8::Local() + , A2 a2 = A2()) { + return imp::Factory::New(callback, data, a2); +} + +// Convenience + +#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION +template inline v8::Local New(v8::Handle h); +#endif + +#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +template + inline v8::Local New(v8::Persistent const& p); +#else +template inline v8::Local New(v8::Persistent const& p); +#endif +template +inline v8::Local New(Persistent const& p); +template +inline v8::Local New(Global const& p); + +inline +imp::Factory::return_t +New(bool value) { + return New(value); +} + +inline +imp::Factory::return_t +New(int32_t value) { + return New(value); +} + +inline +imp::Factory::return_t +New(uint32_t value) { + return New(value); +} + +inline +imp::Factory::return_t +New(double value) { + return New(value); +} + +inline +imp::Factory::return_t +New(std::string const& value) { // NOLINT(build/include_what_you_use) + return New(value); +} + +inline +imp::Factory::return_t +New(const char * value, int length) { + return New(value, length); +} + +inline +imp::Factory::return_t +New(const uint16_t * value, int length) { + return New(value, length); +} + +inline +imp::Factory::return_t +New(const char * value) { + return New(value); +} + +inline +imp::Factory::return_t +New(const uint16_t * value) { + return New(value); +} + +inline +imp::Factory::return_t +New(v8::String::ExternalStringResource * value) { + return New(value); +} + +inline +imp::Factory::return_t +New(ExternalOneByteStringResource * value) { + return New(value); +} + +inline +imp::Factory::return_t +New(v8::Local pattern, v8::RegExp::Flags flags) { + return New(pattern, flags); +} + +#endif // NAN_NEW_H_ diff --git a/node_modules/nan/nan_object_wrap.h b/node_modules/nan/nan_object_wrap.h new file mode 100644 index 00000000..78712f9c --- /dev/null +++ b/node_modules/nan/nan_object_wrap.h @@ -0,0 +1,156 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_OBJECT_WRAP_H_ +#define NAN_OBJECT_WRAP_H_ + +class ObjectWrap { + public: + ObjectWrap() { + refs_ = 0; + } + + + virtual ~ObjectWrap() { + if (persistent().IsEmpty()) { + return; + } + + persistent().ClearWeak(); + persistent().Reset(); + } + + + template + static inline T* Unwrap(v8::Local object) { + assert(!object.IsEmpty()); + assert(object->InternalFieldCount() > 0); + // Cast to ObjectWrap before casting to T. A direct cast from void + // to T won't work right when T has more than one base class. + void* ptr = GetInternalFieldPointer(object, 0); + ObjectWrap* wrap = static_cast(ptr); + return static_cast(wrap); + } + + + inline v8::Local handle() const { + return New(handle_); + } + + + inline Persistent& persistent() { + return handle_; + } + + + protected: + inline void Wrap(v8::Local object) { + assert(persistent().IsEmpty()); + assert(object->InternalFieldCount() > 0); + SetInternalFieldPointer(object, 0, this); + persistent().Reset(object); + MakeWeak(); + } + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + + inline void MakeWeak() { + persistent().v8::PersistentBase::SetWeak( + this, WeakCallback, v8::WeakCallbackType::kParameter); +#if NODE_MAJOR_VERSION < 10 + // FIXME(bnoordhuis) Probably superfluous in older Node.js versions too. + persistent().MarkIndependent(); +#endif + } + +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + + inline void MakeWeak() { + persistent().v8::PersistentBase::SetWeak(this, WeakCallback); + persistent().MarkIndependent(); + } + +#else + + inline void MakeWeak() { + persistent().persistent.MakeWeak(this, WeakCallback); + persistent().MarkIndependent(); + } + +#endif + + /* Ref() marks the object as being attached to an event loop. + * Refed objects will not be garbage collected, even if + * all references are lost. + */ + virtual void Ref() { + assert(!persistent().IsEmpty()); + persistent().ClearWeak(); + refs_++; + } + + /* Unref() marks an object as detached from the event loop. This is its + * default state. When an object with a "weak" reference changes from + * attached to detached state it will be freed. Be careful not to access + * the object after making this call as it might be gone! + * (A "weak reference" means an object that only has a + * persistent handle.) + * + * DO NOT CALL THIS FROM DESTRUCTOR + */ + virtual void Unref() { + assert(!persistent().IsEmpty()); + assert(!persistent().IsWeak()); + assert(refs_ > 0); + if (--refs_ == 0) + MakeWeak(); + } + + int refs_; // ro + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap) +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + + static void + WeakCallback(v8::WeakCallbackInfo const& info) { + ObjectWrap* wrap = info.GetParameter(); + assert(wrap->refs_ == 0); + wrap->handle_.Reset(); + delete wrap; + } + +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + + static void + WeakCallback(v8::WeakCallbackData const& data) { + ObjectWrap* wrap = data.GetParameter(); + assert(wrap->refs_ == 0); + assert(wrap->handle_.IsNearDeath()); + wrap->handle_.Reset(); + delete wrap; + } + +#else + + static void WeakCallback(v8::Persistent value, void *data) { + ObjectWrap *wrap = static_cast(data); + assert(wrap->refs_ == 0); + assert(wrap->handle_.IsNearDeath()); + wrap->handle_.Reset(); + delete wrap; + } + +#endif + Persistent handle_; +}; + + +#endif // NAN_OBJECT_WRAP_H_ diff --git a/node_modules/nan/nan_persistent_12_inl.h b/node_modules/nan/nan_persistent_12_inl.h new file mode 100644 index 00000000..d9649e86 --- /dev/null +++ b/node_modules/nan/nan_persistent_12_inl.h @@ -0,0 +1,132 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_PERSISTENT_12_INL_H_ +#define NAN_PERSISTENT_12_INL_H_ + +template class Persistent : + public v8::Persistent { + public: + inline Persistent() : v8::Persistent() {} + + template inline Persistent(v8::Local that) : + v8::Persistent(v8::Isolate::GetCurrent(), that) {} + + template + inline + Persistent(const v8::Persistent &that) : // NOLINT(runtime/explicit) + v8::Persistent(v8::Isolate::GetCurrent(), that) {} + + inline void Reset() { v8::PersistentBase::Reset(); } + + template + inline void Reset(const v8::Local &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void Reset(const v8::PersistentBase &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type); + + private: + inline T *operator*() const { return *PersistentBase::persistent; } + + template + inline void Copy(const Persistent &that) { + TYPE_CHECK(T, S); + + this->Reset(); + + if (!that.IsEmpty()) { + this->Reset(that); + M::Copy(that, this); + } + } +}; + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +template +class Global : public v8::Global { + public: + inline Global() : v8::Global() {} + + template inline Global(v8::Local that) : + v8::Global(v8::Isolate::GetCurrent(), that) {} + + template + inline + Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) + v8::Global(v8::Isolate::GetCurrent(), that) {} + + inline void Reset() { v8::PersistentBase::Reset(); } + + template + inline void Reset(const v8::Local &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void Reset(const v8::PersistentBase &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + reinterpret_cast*>(this)->SetWeak( + parameter, callback, type); + } +}; +#else +template +class Global : public v8::UniquePersistent { + public: + inline Global() : v8::UniquePersistent() {} + + template inline Global(v8::Local that) : + v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} + + template + inline + Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) + v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} + + inline void Reset() { v8::PersistentBase::Reset(); } + + template + inline void Reset(const v8::Local &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void Reset(const v8::PersistentBase &other) { + v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); + } + + template + inline void SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + reinterpret_cast*>(this)->SetWeak( + parameter, callback, type); + } +}; +#endif + +#endif // NAN_PERSISTENT_12_INL_H_ diff --git a/node_modules/nan/nan_persistent_pre_12_inl.h b/node_modules/nan/nan_persistent_pre_12_inl.h new file mode 100644 index 00000000..4c9c59da --- /dev/null +++ b/node_modules/nan/nan_persistent_pre_12_inl.h @@ -0,0 +1,242 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_PERSISTENT_PRE_12_INL_H_ +#define NAN_PERSISTENT_PRE_12_INL_H_ + +template +class PersistentBase { + v8::Persistent persistent; + template + friend v8::Local New(const PersistentBase &p); + template + friend v8::Local New(const Persistent &p); + template + friend v8::Local New(const Global &p); + template friend class ReturnValue; + + public: + inline PersistentBase() : + persistent() {} + + inline void Reset() { + persistent.Dispose(); + persistent.Clear(); + } + + template + inline void Reset(const v8::Local &other) { + TYPE_CHECK(T, S); + + if (!persistent.IsEmpty()) { + persistent.Dispose(); + } + + if (other.IsEmpty()) { + persistent.Clear(); + } else { + persistent = v8::Persistent::New(other); + } + } + + template + inline void Reset(const PersistentBase &other) { + TYPE_CHECK(T, S); + + if (!persistent.IsEmpty()) { + persistent.Dispose(); + } + + if (other.IsEmpty()) { + persistent.Clear(); + } else { + persistent = v8::Persistent::New(other.persistent); + } + } + + inline bool IsEmpty() const { return persistent.IsEmpty(); } + + inline void Empty() { persistent.Clear(); } + + template + inline bool operator==(const PersistentBase &that) const { + return this->persistent == that.persistent; + } + + template + inline bool operator==(const v8::Local &that) const { + return this->persistent == that; + } + + template + inline bool operator!=(const PersistentBase &that) const { + return !operator==(that); + } + + template + inline bool operator!=(const v8::Local &that) const { + return !operator==(that); + } + + template + inline void SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type); + + inline void ClearWeak() { persistent.ClearWeak(); } + + inline void MarkIndependent() { persistent.MarkIndependent(); } + + inline bool IsIndependent() const { return persistent.IsIndependent(); } + + inline bool IsNearDeath() const { return persistent.IsNearDeath(); } + + inline bool IsWeak() const { return persistent.IsWeak(); } + + private: + inline explicit PersistentBase(v8::Persistent that) : + persistent(that) { } + inline explicit PersistentBase(T *val) : persistent(val) {} + template friend class Persistent; + template friend class Global; + friend class ObjectWrap; +}; + +template +class NonCopyablePersistentTraits { + public: + typedef Persistent > + NonCopyablePersistent; + static const bool kResetInDestructor = false; + template + inline static void Copy(const Persistent &source, + NonCopyablePersistent *dest) { + Uncompilable(); + } + + template inline static void Uncompilable() { + TYPE_CHECK(O, v8::Primitive); + } +}; + +template +struct CopyablePersistentTraits { + typedef Persistent > CopyablePersistent; + static const bool kResetInDestructor = true; + template + static inline void Copy(const Persistent &source, + CopyablePersistent *dest) {} +}; + +template class Persistent : + public PersistentBase { + public: + inline Persistent() {} + + template inline Persistent(v8::Handle that) + : PersistentBase(v8::Persistent::New(that)) { + TYPE_CHECK(T, S); + } + + inline Persistent(const Persistent &that) : PersistentBase() { + Copy(that); + } + + template + inline Persistent(const Persistent &that) : + PersistentBase() { + Copy(that); + } + + inline Persistent &operator=(const Persistent &that) { + Copy(that); + return *this; + } + + template + inline Persistent &operator=(const Persistent &that) { + Copy(that); + return *this; + } + + inline ~Persistent() { + if (M::kResetInDestructor) this->Reset(); + } + + private: + inline T *operator*() const { return *PersistentBase::persistent; } + + template + inline void Copy(const Persistent &that) { + TYPE_CHECK(T, S); + + this->Reset(); + + if (!that.IsEmpty()) { + this->persistent = v8::Persistent::New(that.persistent); + M::Copy(that, this); + } + } +}; + +template +class Global : public PersistentBase { + struct RValue { + inline explicit RValue(Global* obj) : object(obj) {} + Global* object; + }; + + public: + inline Global() : PersistentBase(0) { } + + template + inline Global(v8::Local that) // NOLINT(runtime/explicit) + : PersistentBase(v8::Persistent::New(that)) { + TYPE_CHECK(T, S); + } + + template + inline Global(const PersistentBase &that) // NOLINT(runtime/explicit) + : PersistentBase(that) { + TYPE_CHECK(T, S); + } + /** + * Move constructor. + */ + inline Global(RValue rvalue) // NOLINT(runtime/explicit) + : PersistentBase(rvalue.object->persistent) { + rvalue.object->Reset(); + } + inline ~Global() { this->Reset(); } + /** + * Move via assignment. + */ + template + inline Global &operator=(Global rhs) { + TYPE_CHECK(T, S); + this->Reset(rhs.persistent); + rhs.Reset(); + return *this; + } + /** + * Cast operator for moves. + */ + inline operator RValue() { return RValue(this); } + /** + * Pass allows returning uniques from functions, etc. + */ + Global Pass() { return Global(RValue(this)); } + + private: + Global(Global &); + void operator=(Global &); + template friend class ReturnValue; +}; + +#endif // NAN_PERSISTENT_PRE_12_INL_H_ diff --git a/node_modules/nan/nan_private.h b/node_modules/nan/nan_private.h new file mode 100644 index 00000000..15f44cc8 --- /dev/null +++ b/node_modules/nan/nan_private.h @@ -0,0 +1,73 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_PRIVATE_H_ +#define NAN_PRIVATE_H_ + +inline Maybe +HasPrivate(v8::Local object, v8::Local key) { + HandleScope scope; +#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::Local context = isolate->GetCurrentContext(); + v8::Local private_key = v8::Private::ForApi(isolate, key); + return object->HasPrivate(context, private_key); +#else + return Just(!object->GetHiddenValue(key).IsEmpty()); +#endif +} + +inline MaybeLocal +GetPrivate(v8::Local object, v8::Local key) { +#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope scope(isolate); + v8::Local context = isolate->GetCurrentContext(); + v8::Local private_key = v8::Private::ForApi(isolate, key); + v8::MaybeLocal v = object->GetPrivate(context, private_key); + return scope.Escape(v.ToLocalChecked()); +#else + EscapableHandleScope scope; + v8::Local v = object->GetHiddenValue(key); + if (v.IsEmpty()) { + v = Undefined(); + } + return scope.Escape(v); +#endif +} + +inline Maybe SetPrivate( + v8::Local object, + v8::Local key, + v8::Local value) { +#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION + HandleScope scope; + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::Local context = isolate->GetCurrentContext(); + v8::Local private_key = v8::Private::ForApi(isolate, key); + return object->SetPrivate(context, private_key, value); +#else + return Just(object->SetHiddenValue(key, value)); +#endif +} + +inline Maybe DeletePrivate( + v8::Local object, + v8::Local key) { +#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION + HandleScope scope; + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::Local private_key = v8::Private::ForApi(isolate, key); + return object->DeletePrivate(isolate->GetCurrentContext(), private_key); +#else + return Just(object->DeleteHiddenValue(key)); +#endif +} + +#endif // NAN_PRIVATE_H_ + diff --git a/node_modules/nan/nan_string_bytes.h b/node_modules/nan/nan_string_bytes.h new file mode 100644 index 00000000..a2e6437d --- /dev/null +++ b/node_modules/nan/nan_string_bytes.h @@ -0,0 +1,305 @@ +// 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. + +#ifndef NAN_STRING_BYTES_H_ +#define NAN_STRING_BYTES_H_ + +// Decodes a v8::Local or Buffer to a raw char* + +namespace imp { + +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + + +//// Base 64 //// + +#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) + + + +//// HEX //// + +static bool contains_non_ascii_slow(const char* buf, size_t len) { + for (size_t i = 0; i < len; ++i) { + if (buf[i] & 0x80) return true; + } + return false; +} + + +static bool contains_non_ascii(const char* src, size_t len) { + if (len < 16) { + return contains_non_ascii_slow(src, len); + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned unaligned = reinterpret_cast(src) & align_mask; + + if (unaligned > 0) { + const unsigned n = bytes_per_word - unaligned; + if (contains_non_ascii_slow(src, n)) return true; + src += n; + len -= n; + } + + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = 0x8080808080808080ll; +#else + const uintptr_t mask = 0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + if (srcw[i] & mask) return true; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + if (contains_non_ascii_slow(src + offset, remainder)) return true; + } + + return false; +} + + +static void force_ascii_slow(const char* src, char* dst, size_t len) { + for (size_t i = 0; i < len; ++i) { + dst[i] = src[i] & 0x7f; + } +} + + +static void force_ascii(const char* src, char* dst, size_t len) { + if (len < 16) { + force_ascii_slow(src, dst, len); + return; + } + + const unsigned bytes_per_word = sizeof(void*); + const unsigned align_mask = bytes_per_word - 1; + const unsigned src_unalign = reinterpret_cast(src) & align_mask; + const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; + + if (src_unalign > 0) { + if (src_unalign == dst_unalign) { + const unsigned unalign = bytes_per_word - src_unalign; + force_ascii_slow(src, dst, unalign); + src += unalign; + dst += unalign; + len -= src_unalign; + } else { + force_ascii_slow(src, dst, len); + return; + } + } + +#if defined(__x86_64__) || defined(_WIN64) + const uintptr_t mask = ~0x8080808080808080ll; +#else + const uintptr_t mask = ~0x80808080l; +#endif + + const uintptr_t* srcw = reinterpret_cast(src); + uintptr_t* dstw = reinterpret_cast(dst); + + for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { + dstw[i] = srcw[i] & mask; + } + + const unsigned remainder = len & align_mask; + if (remainder > 0) { + const size_t offset = len - remainder; + force_ascii_slow(src + offset, dst + offset, remainder); + } +} + + +static size_t base64_encode(const char* src, + size_t slen, + char* dst, + size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= base64_encoded_size(slen) && + "not enough space provided for base64 encode"); + + dlen = base64_encoded_size(slen); + + unsigned a; + unsigned b; + unsigned c; + unsigned i; + unsigned k; + unsigned n; + + static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + + i = 0; + k = 0; + n = slen / 3 * 3; + + while (i < n) { + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + c = src[i + 2] & 0xff; + + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; + dst[k + 3] = table[c & 0x3f]; + + i += 3; + k += 4; + } + + if (n != slen) { + switch (slen - n) { + case 1: + a = src[i + 0] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[(a & 3) << 4]; + dst[k + 2] = '='; + dst[k + 3] = '='; + break; + + case 2: + a = src[i + 0] & 0xff; + b = src[i + 1] & 0xff; + dst[k + 0] = table[a >> 2]; + dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; + dst[k + 2] = table[(b & 0x0f) << 2]; + dst[k + 3] = '='; + break; + } + } + + return dlen; +} + + +static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { + // We know how much we'll write, just make sure that there's space. + assert(dlen >= slen * 2 && + "not enough space provided for hex encode"); + + dlen = slen * 2; + for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { + static const char hex[] = "0123456789abcdef"; + uint8_t val = static_cast(src[i]); + dst[k + 0] = hex[val >> 4]; + dst[k + 1] = hex[val & 15]; + } + + return dlen; +} + + + +static Local Encode(const char* buf, + size_t buflen, + enum Encoding encoding) { + assert(buflen <= node::Buffer::kMaxLength); + if (!buflen && encoding != BUFFER) + return New("").ToLocalChecked(); + + Local val; + switch (encoding) { + case BUFFER: + return CopyBuffer(buf, buflen).ToLocalChecked(); + + case ASCII: + if (contains_non_ascii(buf, buflen)) { + char* out = new char[buflen]; + force_ascii(buf, out, buflen); + val = New(out, buflen).ToLocalChecked(); + delete[] out; + } else { + val = New(buf, buflen).ToLocalChecked(); + } + break; + + case UTF8: + val = New(buf, buflen).ToLocalChecked(); + break; + + case BINARY: { + // TODO(isaacs) use ExternalTwoByteString? + const unsigned char *cbuf = reinterpret_cast(buf); + uint16_t * twobytebuf = new uint16_t[buflen]; + for (size_t i = 0; i < buflen; i++) { + // XXX is the following line platform independent? + twobytebuf[i] = cbuf[i]; + } + val = New(twobytebuf, buflen).ToLocalChecked(); + delete[] twobytebuf; + break; + } + + case BASE64: { + size_t dlen = base64_encoded_size(buflen); + char* dst = new char[dlen]; + + size_t written = base64_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = New(dst, dlen).ToLocalChecked(); + delete[] dst; + break; + } + + case UCS2: { + const uint16_t* data = reinterpret_cast(buf); + val = New(data, buflen / 2).ToLocalChecked(); + break; + } + + case HEX: { + size_t dlen = buflen * 2; + char* dst = new char[dlen]; + size_t written = hex_encode(buf, buflen, dst, dlen); + assert(written == dlen); + + val = New(dst, dlen).ToLocalChecked(); + delete[] dst; + break; + } + + default: + assert(0 && "unknown encoding"); + break; + } + + return val; +} + +#undef base64_encoded_size + +} // end of namespace imp + +#endif // NAN_STRING_BYTES_H_ diff --git a/node_modules/nan/nan_typedarray_contents.h b/node_modules/nan/nan_typedarray_contents.h new file mode 100644 index 00000000..c6ac8a41 --- /dev/null +++ b/node_modules/nan/nan_typedarray_contents.h @@ -0,0 +1,96 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_TYPEDARRAY_CONTENTS_H_ +#define NAN_TYPEDARRAY_CONTENTS_H_ + +template +class TypedArrayContents { + public: + inline explicit TypedArrayContents(v8::Local from) : + length_(0), data_(NULL) { + HandleScope scope; + + size_t length = 0; + void* data = NULL; + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + + if (from->IsArrayBufferView()) { + v8::Local array = + v8::Local::Cast(from); + + const size_t byte_length = array->ByteLength(); + const ptrdiff_t byte_offset = array->ByteOffset(); + v8::Local buffer = array->Buffer(); + + length = byte_length / sizeof(T); +// Actually it's 7.9 here but this would lead to ABI issues with Node.js 13 +// using 7.8 till 13.2.0. +#if (V8_MAJOR_VERSION >= 8) + data = static_cast(buffer->GetBackingStore()->Data()) + byte_offset; +#else + data = static_cast(buffer->GetContents().Data()) + byte_offset; +#endif + } + +#else + + if (from->IsObject() && !from->IsNull()) { + v8::Local array = v8::Local::Cast(from); + + MaybeLocal buffer = Get(array, + New("buffer").ToLocalChecked()); + MaybeLocal byte_length = Get(array, + New("byteLength").ToLocalChecked()); + MaybeLocal byte_offset = Get(array, + New("byteOffset").ToLocalChecked()); + + if (!buffer.IsEmpty() && + !byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() && + !byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) { + data = array->GetIndexedPropertiesExternalArrayData(); + if(data) { + length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T); + } + } + } + +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L + assert(reinterpret_cast(data) % alignof (T) == 0); +#elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__) + assert(reinterpret_cast(data) % __alignof(T) == 0); +#else + assert(reinterpret_cast(data) % sizeof (T) == 0); +#endif + + length_ = length; + data_ = static_cast(data); + } + + inline size_t length() const { return length_; } + inline T* operator*() { return data_; } + inline const T* operator*() const { return data_; } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents) + + //Disable heap allocation + void *operator new(size_t size); + void operator delete(void *, size_t) { + abort(); + } + + size_t length_; + T* data_; +}; + +#endif // NAN_TYPEDARRAY_CONTENTS_H_ diff --git a/node_modules/nan/nan_weak.h b/node_modules/nan/nan_weak.h new file mode 100644 index 00000000..7e7ab07b --- /dev/null +++ b/node_modules/nan/nan_weak.h @@ -0,0 +1,437 @@ +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +#ifndef NAN_WEAK_H_ +#define NAN_WEAK_H_ + +static const int kInternalFieldsInWeakCallback = 2; +static const int kNoInternalFieldIndex = -1; + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ + v8::WeakCallbackInfo > const& +# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION +# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ + v8::PhantomCallbackData > const& +# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION +# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ + v8::PhantomCallbackData > const& +# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ + v8::InternalFieldsCallbackData, void> const& +# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +# define NAN_WEAK_CALLBACK_DATA_TYPE_ \ + v8::WeakCallbackData > const& +# define NAN_WEAK_CALLBACK_SIG_ NAN_WEAK_CALLBACK_DATA_TYPE_ +#else +# define NAN_WEAK_CALLBACK_DATA_TYPE_ void * +# define NAN_WEAK_CALLBACK_SIG_ \ + v8::Persistent, NAN_WEAK_CALLBACK_DATA_TYPE_ +#endif + +template +class WeakCallbackInfo { + public: + typedef void (*Callback)(const WeakCallbackInfo& data); + WeakCallbackInfo( + Persistent *persistent + , Callback callback + , void *parameter + , void *field1 = 0 + , void *field2 = 0) : + callback_(callback), isolate_(0), parameter_(parameter) { + std::memcpy(&persistent_, persistent, sizeof (v8::Persistent)); + internal_fields_[0] = field1; + internal_fields_[1] = field2; + } + inline v8::Isolate *GetIsolate() const { return isolate_; } + inline T *GetParameter() const { return static_cast(parameter_); } + inline void *GetInternalField(int index) const { + assert((index == 0 || index == 1) && "internal field index out of bounds"); + if (index == 0) { + return internal_fields_[0]; + } else { + return internal_fields_[1]; + } + } + + private: + NAN_DISALLOW_ASSIGN_COPY_MOVE(WeakCallbackInfo) + Callback callback_; + v8::Isolate *isolate_; + void *parameter_; + void *internal_fields_[kInternalFieldsInWeakCallback]; + v8::Persistent persistent_; + template friend class Persistent; + template friend class PersistentBase; +#if NODE_MODULE_VERSION <= NODE_0_12_MODULE_VERSION +# if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + template + static void invoke(NAN_WEAK_CALLBACK_SIG_ data); + template + static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); +# else + static void invoke(NAN_WEAK_CALLBACK_SIG_ data); + static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); +# endif +#else +# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + template + static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); + template + static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); +# else + static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); + static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); +# endif + static WeakCallbackInfo *unwrapparameter( + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data); + static WeakCallbackInfo *unwraptwofield( + NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data); +#endif +}; + + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) + +template +template +void +WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwrapparameter(data); + if (isFirstPass) { + cbinfo->persistent_.Reset(); + data.SetSecondPassCallback(invokeparameter); + } else { + cbinfo->callback_(*cbinfo); + delete cbinfo; + } +} + +template +template +void +WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwraptwofield(data); + if (isFirstPass) { + cbinfo->persistent_.Reset(); + data.SetSecondPassCallback(invoketwofield); + } else { + cbinfo->callback_(*cbinfo); + delete cbinfo; + } +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data.GetParameter()); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( + NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data.GetInternalField(0)); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ +#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ +#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +# elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION + +template +void +WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwrapparameter(data); + cbinfo->persistent_.Reset(); + cbinfo->callback_(*cbinfo); + delete cbinfo; +} + +template +void +WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwraptwofield(data); + cbinfo->persistent_.Reset(); + cbinfo->callback_(*cbinfo); + delete cbinfo; +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( + NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data.GetParameter()); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( + NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data.GetInternalField1()); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ +#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ +#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ +#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION + +template +template +void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwrap(data); + cbinfo->persistent_.Reset(); + cbinfo->callback_(*cbinfo); + delete cbinfo; +} + +template +template +WeakCallbackInfo *WeakCallbackInfo::unwrap( + NAN_WEAK_CALLBACK_DATA_TYPE_ data) { + void *parameter = data.GetParameter(); + WeakCallbackInfo *cbinfo = + static_cast*>(parameter); + cbinfo->isolate_ = data.GetIsolate(); + return cbinfo; +} + +#undef NAN_WEAK_CALLBACK_SIG_ +#undef NAN_WEAK_CALLBACK_DATA_TYPE_ +#else + +template +void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { + WeakCallbackInfo *cbinfo = unwrap(data); + cbinfo->persistent_.Dispose(); + cbinfo->persistent_.Clear(); + cbinfo->callback_(*cbinfo); + delete cbinfo; +} + +template +WeakCallbackInfo *WeakCallbackInfo::unwrap( + NAN_WEAK_CALLBACK_DATA_TYPE_ data) { + WeakCallbackInfo *cbinfo = + static_cast*>(data); + cbinfo->isolate_ = v8::Isolate::GetCurrent(); + return cbinfo; +} + +#undef NAN_WEAK_CALLBACK_SIG_ +#undef NAN_WEAK_CALLBACK_DATA_TYPE_ +#endif + +#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ + (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) +template +template +inline void Persistent::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + v8::PersistentBase::SetWeak( + wcbd + , WeakCallbackInfo

::template invokeparameter + , type); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetAlignedPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + self->SetAlignedPointerInInternalField(0, wcbd); + v8::PersistentBase::SetWeak( + static_cast*>(0) + , WeakCallbackInfo

::template invoketwofield + , type); + } +} +#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION +template +template +inline void Persistent::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + v8::PersistentBase::SetPhantom( + wcbd + , WeakCallbackInfo

::invokeparameter); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetAlignedPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + self->SetAlignedPointerInInternalField(0, wcbd); + v8::PersistentBase::SetPhantom( + static_cast*>(0) + , WeakCallbackInfo

::invoketwofield + , 0 + , count > 1 ? 1 : kNoInternalFieldIndex); + } +} +#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION +template +template +inline void Persistent::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + v8::PersistentBase::SetPhantom( + wcbd + , WeakCallbackInfo

::invokeparameter); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetAlignedPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + self->SetAlignedPointerInInternalField(0, wcbd); + v8::PersistentBase::SetPhantom( + WeakCallbackInfo

::invoketwofield + , 0 + , count > 1 ? 1 : kNoInternalFieldIndex); + } +} +#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION +template +template +inline void Persistent::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetAlignedPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); + } +} +#else +template +template +inline void PersistentBase::SetWeak( + P *parameter + , typename WeakCallbackInfo

::Callback callback + , WeakCallbackType type) { + WeakCallbackInfo

*wcbd; + if (type == WeakCallbackType::kParameter) { + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , parameter); + persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); + } else { + v8::Local* self_v(reinterpret_cast*>(this)); + assert((*self_v)->IsObject()); + v8::Local self((*self_v).As()); + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { + internal_fields[i] = self->GetPointerFromInternalField(i); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) + , callback + , 0 + , internal_fields[0] + , internal_fields[1]); + persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); + } +} +#endif + +#endif // NAN_WEAK_H_ diff --git a/node_modules/nan/package.json b/node_modules/nan/package.json new file mode 100644 index 00000000..a833059d --- /dev/null +++ b/node_modules/nan/package.json @@ -0,0 +1,98 @@ +{ + "_from": "nan@^2.12.1", + "_id": "nan@2.14.1", + "_inBundle": false, + "_integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", + "_location": "/nan", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "nan@^2.12.1", + "name": "nan", + "escapedName": "nan", + "rawSpec": "^2.12.1", + "saveSpec": null, + "fetchSpec": "^2.12.1" + }, + "_requiredBy": [ + "/fsevents" + ], + "_resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", + "_shasum": "d7be34dfa3105b91494c3147089315eff8874b01", + "_spec": "nan@^2.12.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/fsevents", + "bugs": { + "url": "https://github.com/nodejs/nan/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Rod Vagg", + "email": "r@va.gg", + "url": "https://github.com/rvagg" + }, + { + "name": "Benjamin Byholm", + "email": "bbyholm@abo.fi", + "url": "https://github.com/kkoopa/" + }, + { + "name": "Trevor Norris", + "email": "trev.norris@gmail.com", + "url": "https://github.com/trevnorris" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "https://github.com/TooTallNate" + }, + { + "name": "Brett Lawson", + "email": "brett19@gmail.com", + "url": "https://github.com/brett19" + }, + { + "name": "Ben Noordhuis", + "email": "info@bnoordhuis.nl", + "url": "https://github.com/bnoordhuis" + }, + { + "name": "David Siegel", + "email": "david@artcom.de", + "url": "https://github.com/agnat" + }, + { + "name": "Michael Ira Krufky", + "email": "mkrufky@gmail.com", + "url": "https://github.com/mkrufky" + } + ], + "deprecated": false, + "description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 14 compatibility", + "devDependencies": { + "bindings": "~1.2.1", + "commander": "^2.8.1", + "glob": "^5.0.14", + "node-gyp": "~3.6.2", + "readable-stream": "^2.1.4", + "request": "=2.81.0", + "tap": "~0.7.1", + "xtend": "~4.0.0" + }, + "homepage": "https://github.com/nodejs/nan#readme", + "license": "MIT", + "main": "include_dirs.js", + "name": "nan", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/nan.git" + }, + "scripts": { + "docs": "doc/.build.sh", + "rebuild-tests": "node-gyp rebuild --msvs_version=2015 --directory test", + "test": "tap --gc --stderr test/js/*-test.js", + "test:worker": "node --experimental-worker test/tap-as-worker.js --gc --stderr test/js/*-test.js" + }, + "version": "2.14.1" +} diff --git a/node_modules/nan/tools/1to2.js b/node_modules/nan/tools/1to2.js new file mode 100755 index 00000000..6af25058 --- /dev/null +++ b/node_modules/nan/tools/1to2.js @@ -0,0 +1,412 @@ +#!/usr/bin/env node +/********************************************************************* + * NAN - Native Abstractions for Node.js + * + * Copyright (c) 2018 NAN contributors + * + * MIT License + ********************************************************************/ + +var commander = require('commander'), + fs = require('fs'), + glob = require('glob'), + groups = [], + total = 0, + warning1 = '/* ERROR: Rewrite using Buffer */\n', + warning2 = '\\/\\* ERROR\\: Rewrite using Buffer \\*\\/\\n', + length, + i; + +fs.readFile(__dirname + '/package.json', 'utf8', function (err, data) { + if (err) { + throw err; + } + + commander + .version(JSON.parse(data).version) + .usage('[options] ') + .parse(process.argv); + + if (!process.argv.slice(2).length) { + commander.outputHelp(); + } +}); + +/* construct strings representing regular expressions + each expression contains a unique group allowing for identification of the match + the index of this key group, relative to the regular expression in question, + is indicated by the first array member */ + +/* simple substistutions, key group is the entire match, 0 */ +groups.push([0, [ + '_NAN_', + 'NODE_SET_METHOD', + 'NODE_SET_PROTOTYPE_METHOD', + 'NanAsciiString', + 'NanEscapeScope', + 'NanReturnValue', + 'NanUcs2String'].join('|')]); + +/* substitutions of parameterless macros, key group is 1 */ +groups.push([1, ['(', [ + 'NanEscapableScope', + 'NanReturnNull', + 'NanReturnUndefined', + 'NanScope'].join('|'), ')\\(\\)'].join('')]); + +/* replace TryCatch with NanTryCatch once, gobbling possible namespace, key group 2 */ +groups.push([2, '(?:(?:v8\\:\\:)?|(Nan)?)(TryCatch)']); + +/* NanNew("string") will likely not fail a ToLocalChecked(), key group 1 */ +groups.push([1, ['(NanNew)', '(\\("[^\\"]*"[^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); + +/* Removed v8 APIs, warn that the code needs rewriting using node::Buffer, key group 2 */ +groups.push([2, ['(', warning2, ')?', '^.*?(', [ + 'GetIndexedPropertiesExternalArrayDataLength', + 'GetIndexedPropertiesExternalArrayData', + 'GetIndexedPropertiesExternalArrayDataType', + 'GetIndexedPropertiesPixelData', + 'GetIndexedPropertiesPixelDataLength', + 'HasIndexedPropertiesInExternalArrayData', + 'HasIndexedPropertiesInPixelData', + 'SetIndexedPropertiesToExternalArrayData', + 'SetIndexedPropertiesToPixelData'].join('|'), ')'].join('')]); + +/* No need for NanScope in V8-exposed methods, key group 2 */ +groups.push([2, ['((', [ + 'NAN_METHOD', + 'NAN_GETTER', + 'NAN_SETTER', + 'NAN_PROPERTY_GETTER', + 'NAN_PROPERTY_SETTER', + 'NAN_PROPERTY_ENUMERATOR', + 'NAN_PROPERTY_DELETER', + 'NAN_PROPERTY_QUERY', + 'NAN_INDEX_GETTER', + 'NAN_INDEX_SETTER', + 'NAN_INDEX_ENUMERATOR', + 'NAN_INDEX_DELETER', + 'NAN_INDEX_QUERY'].join('|'), ')\\([^\\)]*\\)\\s*\\{)\\s*NanScope\\(\\)\\s*;'].join('')]); + +/* v8::Value::ToXXXXXXX returns v8::MaybeLocal, key group 3 */ +groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->(', [ + 'Boolean', + 'Number', + 'String', + 'Object', + 'Integer', + 'Uint32', + 'Int32'].join('|'), ')\\('].join('')]); + +/* v8::Value::XXXXXXXValue returns v8::Maybe, key group 3 */ +groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->((?:', [ + 'Boolean', + 'Number', + 'Integer', + 'Uint32', + 'Int32'].join('|'), ')Value)\\('].join('')]); + +/* NAN_WEAK_CALLBACK macro was removed, write out callback definition, key group 1 */ +groups.push([1, '(NAN_WEAK_CALLBACK)\\(([^\\s\\)]+)\\)']); + +/* node::ObjectWrap and v8::Persistent have been replaced with Nan implementations, key group 1 */ +groups.push([1, ['(', [ + 'NanDisposePersistent', + 'NanObjectWrapHandle'].join('|'), ')\\s*\\(\\s*([^\\s\\)]+)'].join('')]); + +/* Since NanPersistent there is no need for NanMakeWeakPersistent, key group 1 */ +groups.push([1, '(NanMakeWeakPersistent)\\s*\\(\\s*([^\\s,]+)\\s*,\\s*']); + +/* Many methods of v8::Object and others now return v8::MaybeLocal, key group 3 */ +groups.push([3, ['([\\s])([^\\s]+)->(', [ + 'GetEndColumn', + 'GetFunction', + 'GetLineNumber', + 'NewInstance', + 'GetPropertyNames', + 'GetOwnPropertyNames', + 'GetSourceLine', + 'GetStartColumn', + 'ObjectProtoToString', + 'ToArrayIndex', + 'ToDetailString', + 'CallAsConstructor', + 'CallAsFunction', + 'CloneElementAt', + 'Delete', + 'ForceSet', + 'Get', + 'GetPropertyAttributes', + 'GetRealNamedProperty', + 'GetRealNamedPropertyInPrototypeChain', + 'Has', + 'HasOwnProperty', + 'HasRealIndexedProperty', + 'HasRealNamedCallbackProperty', + 'HasRealNamedProperty', + 'Set', + 'SetAccessor', + 'SetIndexedPropertyHandler', + 'SetNamedPropertyHandler', + 'SetPrototype'].join('|'), ')\\('].join('')]); + +/* You should get an error if any of these fail anyways, + or handle the error better, it is indicated either way, key group 2 */ +groups.push([2, ['NanNew(<(?:v8\\:\\:)?(', ['Date', 'String', 'RegExp'].join('|'), ')>)(\\([^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); + +/* v8::Value::Equals now returns a v8::Maybe, key group 3 */ +groups.push([3, '([\\s\\(\\)])([^\\s\\(\\)]+)->(Equals)\\(([^\\s\\)]+)']); + +/* NanPersistent makes this unnecessary, key group 1 */ +groups.push([1, '(NanAssignPersistent)(?:]+>)?\\(([^,]+),\\s*']); + +/* args has been renamed to info, key group 2 */ +groups.push([2, '(\\W)(args)(\\W)']) + +/* node::ObjectWrap was replaced with NanObjectWrap, key group 2 */ +groups.push([2, '(\\W)(?:node\\:\\:)?(ObjectWrap)(\\W)']); + +/* v8::Persistent was replaced with NanPersistent, key group 2 */ +groups.push([2, '(\\W)(?:v8\\:\\:)?(Persistent)(\\W)']); + +/* counts the number of capturing groups in a well-formed regular expression, + ignoring non-capturing groups and escaped parentheses */ +function groupcount(s) { + var positive = s.match(/\((?!\?)/g), + negative = s.match(/\\\(/g); + return (positive ? positive.length : 0) - (negative ? negative.length : 0); +} + +/* compute the absolute position of each key group in the joined master RegExp */ +for (i = 1, length = groups.length; i < length; i++) { + total += groupcount(groups[i - 1][1]); + groups[i][0] += total; +} + +/* create the master RegExp, whis is the union of all the groups' expressions */ +master = new RegExp(groups.map(function (a) { return a[1]; }).join('|'), 'gm'); + +/* replacement function for String.replace, receives 21 arguments */ +function replace() { + /* simple expressions */ + switch (arguments[groups[0][0]]) { + case '_NAN_': + return 'NAN_'; + case 'NODE_SET_METHOD': + return 'NanSetMethod'; + case 'NODE_SET_PROTOTYPE_METHOD': + return 'NanSetPrototypeMethod'; + case 'NanAsciiString': + return 'NanUtf8String'; + case 'NanEscapeScope': + return 'scope.Escape'; + case 'NanReturnNull': + return 'info.GetReturnValue().SetNull'; + case 'NanReturnValue': + return 'info.GetReturnValue().Set'; + case 'NanUcs2String': + return 'v8::String::Value'; + default: + } + + /* macros without arguments */ + switch (arguments[groups[1][0]]) { + case 'NanEscapableScope': + return 'NanEscapableScope scope' + case 'NanReturnUndefined': + return 'return'; + case 'NanScope': + return 'NanScope scope'; + default: + } + + /* TryCatch, emulate negative backref */ + if (arguments[groups[2][0]] === 'TryCatch') { + return arguments[groups[2][0] - 1] ? arguments[0] : 'NanTryCatch'; + } + + /* NanNew("foo") --> NanNew("foo").ToLocalChecked() */ + if (arguments[groups[3][0]] === 'NanNew') { + return [arguments[0], '.ToLocalChecked()'].join(''); + } + + /* insert warning for removed functions as comment on new line above */ + switch (arguments[groups[4][0]]) { + case 'GetIndexedPropertiesExternalArrayData': + case 'GetIndexedPropertiesExternalArrayDataLength': + case 'GetIndexedPropertiesExternalArrayDataType': + case 'GetIndexedPropertiesPixelData': + case 'GetIndexedPropertiesPixelDataLength': + case 'HasIndexedPropertiesInExternalArrayData': + case 'HasIndexedPropertiesInPixelData': + case 'SetIndexedPropertiesToExternalArrayData': + case 'SetIndexedPropertiesToPixelData': + return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); + default: + } + + /* remove unnecessary NanScope() */ + switch (arguments[groups[5][0]]) { + case 'NAN_GETTER': + case 'NAN_METHOD': + case 'NAN_SETTER': + case 'NAN_INDEX_DELETER': + case 'NAN_INDEX_ENUMERATOR': + case 'NAN_INDEX_GETTER': + case 'NAN_INDEX_QUERY': + case 'NAN_INDEX_SETTER': + case 'NAN_PROPERTY_DELETER': + case 'NAN_PROPERTY_ENUMERATOR': + case 'NAN_PROPERTY_GETTER': + case 'NAN_PROPERTY_QUERY': + case 'NAN_PROPERTY_SETTER': + return arguments[groups[5][0] - 1]; + default: + } + + /* Value conversion */ + switch (arguments[groups[6][0]]) { + case 'Boolean': + case 'Int32': + case 'Integer': + case 'Number': + case 'Object': + case 'String': + case 'Uint32': + return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); + default: + } + + /* other value conversion */ + switch (arguments[groups[7][0]]) { + case 'BooleanValue': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'Int32Value': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'IntegerValue': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + case 'Uint32Value': + return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); + default: + } + + /* NAN_WEAK_CALLBACK */ + if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { + return ['template\nvoid ', + arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); + } + + /* use methods on NAN classes instead */ + switch (arguments[groups[9][0]]) { + case 'NanDisposePersistent': + return [arguments[groups[9][0] + 1], '.Reset('].join(''); + case 'NanObjectWrapHandle': + return [arguments[groups[9][0] + 1], '->handle('].join(''); + default: + } + + /* use method on NanPersistent instead */ + if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { + return arguments[groups[10][0] + 1] + '.SetWeak('; + } + + /* These return Maybes, the upper ones take no arguments */ + switch (arguments[groups[11][0]]) { + case 'GetEndColumn': + case 'GetFunction': + case 'GetLineNumber': + case 'GetOwnPropertyNames': + case 'GetPropertyNames': + case 'GetSourceLine': + case 'GetStartColumn': + case 'NewInstance': + case 'ObjectProtoToString': + case 'ToArrayIndex': + case 'ToDetailString': + return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); + case 'CallAsConstructor': + case 'CallAsFunction': + case 'CloneElementAt': + case 'Delete': + case 'ForceSet': + case 'Get': + case 'GetPropertyAttributes': + case 'GetRealNamedProperty': + case 'GetRealNamedPropertyInPrototypeChain': + case 'Has': + case 'HasOwnProperty': + case 'HasRealIndexedProperty': + case 'HasRealNamedCallbackProperty': + case 'HasRealNamedProperty': + case 'Set': + case 'SetAccessor': + case 'SetIndexedPropertyHandler': + case 'SetNamedPropertyHandler': + case 'SetPrototype': + return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); + default: + } + + /* Automatic ToLocalChecked(), take it or leave it */ + switch (arguments[groups[12][0]]) { + case 'Date': + case 'String': + case 'RegExp': + return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); + default: + } + + /* NanEquals is now required for uniformity */ + if (arguments[groups[13][0]] === 'Equals') { + return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); + } + + /* use method on replacement class instead */ + if (arguments[groups[14][0]] === 'NanAssignPersistent') { + return [arguments[groups[14][0] + 1], '.Reset('].join(''); + } + + /* args --> info */ + if (arguments[groups[15][0]] === 'args') { + return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); + } + + /* ObjectWrap --> NanObjectWrap */ + if (arguments[groups[16][0]] === 'ObjectWrap') { + return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); + } + + /* Persistent --> NanPersistent */ + if (arguments[groups[17][0]] === 'Persistent') { + return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); + } + + /* This should not happen. A switch is probably missing a case if it does. */ + throw 'Unhandled match: ' + arguments[0]; +} + +/* reads a file, runs replacement and writes it back */ +function processFile(file) { + fs.readFile(file, {encoding: 'utf8'}, function (err, data) { + if (err) { + throw err; + } + + /* run replacement twice, might need more runs */ + fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { + if (err) { + throw err; + } + }); + }); +} + +/* process file names from command line and process the identified files */ +for (i = 2, length = process.argv.length; i < length; i++) { + glob(process.argv[i], function (err, matches) { + if (err) { + throw err; + } + matches.forEach(processFile); + }); +} diff --git a/node_modules/nan/tools/README.md b/node_modules/nan/tools/README.md new file mode 100644 index 00000000..7f07e4b8 --- /dev/null +++ b/node_modules/nan/tools/README.md @@ -0,0 +1,14 @@ +1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, +false positives and missed opportunities. The input files are rewritten in place. Make sure that +you have backups. You will have to manually review the changes afterwards and do some touchups. + +```sh +$ tools/1to2.js + + Usage: 1to2 [options] + + Options: + + -h, --help output usage information + -V, --version output the version number +``` diff --git a/node_modules/nan/tools/package.json b/node_modules/nan/tools/package.json new file mode 100644 index 00000000..2dcdd789 --- /dev/null +++ b/node_modules/nan/tools/package.json @@ -0,0 +1,19 @@ +{ + "name": "1to2", + "version": "1.0.0", + "description": "NAN 1 -> 2 Migration Script", + "main": "1to2.js", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/nan.git" + }, + "contributors": [ + "Benjamin Byholm (https://github.com/kkoopa/)", + "Mathias Küsel (https://github.com/mathiask88/)" + ], + "dependencies": { + "glob": "~5.0.10", + "commander": "~2.8.1" + }, + "license": "MIT" +} diff --git a/node_modules/nanomatch/CHANGELOG.md b/node_modules/nanomatch/CHANGELOG.md new file mode 100644 index 00000000..8c3aead9 --- /dev/null +++ b/node_modules/nanomatch/CHANGELOG.md @@ -0,0 +1,57 @@ +## History + +### key + +Changelog entries are classified using the following labels _(from [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 +- `bumped`: updated dependencies, only minor or higher will be listed. + +### [1.1.0] - 2017-04-11 + +**Fixed** + +- adds support for unclosed quotes + +**Added** + +- adds support for `options.noglobstar` + +### [1.0.4] - 2017-04-06 + +Housekeeping updates. Adds documentation section about escaping, cleans up utils. + +### [1.0.3] - 2017-04-06 + +This release includes fixes for windows path edge cases and other improvements for stricter adherence to bash spec. + +**Fixed** + +- More windows path edge cases + +**Added** + +- Support for bash-like quoted strings for escaping sequences of characters, such as `foo/"**"/bar` where `**` should be matched literally and not evaluated as special characters. + +### [1.0.1] - 2016-12-12 + +**Added** + +- Support for windows path edge cases where backslashes are used in brackets or other unusual combinations. + +### [1.0.0] - 2016-12-12 + +Stable release. + +### [0.1.0] - 2016-10-08 + +First release. + +[Unreleased]: https://github.com/jonschlinkert/nanomatch/compare/0.1.0...HEAD +[0.2.0]: https://github.com/jonschlinkert/nanomatch/compare/0.1.0...0.2.0 + +[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/node_modules/nanomatch/LICENSE b/node_modules/nanomatch/LICENSE new file mode 100644 index 00000000..7c9987bc --- /dev/null +++ b/node_modules/nanomatch/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/nanomatch/README.md b/node_modules/nanomatch/README.md new file mode 100644 index 00000000..bdd35a94 --- /dev/null +++ b/node_modules/nanomatch/README.md @@ -0,0 +1,1148 @@ +# nanomatch [![NPM version](https://img.shields.io/npm/v/nanomatch.svg?style=flat)](https://www.npmjs.com/package/nanomatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/nanomatch.svg?style=flat)](https://npmjs.org/package/nanomatch) [![NPM total downloads](https://img.shields.io/npm/dt/nanomatch.svg?style=flat)](https://npmjs.org/package/nanomatch) [![Linux Build Status](https://img.shields.io/travis/micromatch/nanomatch.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/nanomatch) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/nanomatch.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/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) + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Table of Contents + +

+Details + +- [Install](#install) +- [What is nanomatch?](#what-is-nanomatch) +- [Getting started](#getting-started) + * [Installing nanomatch](#installing-nanomatch) + * [Usage](#usage) +- [Documentation](#documentation) + * [Escaping](#escaping) +- [API](#api) +- [Options](#options) + * [options.basename](#optionsbasename) + * [options.bash](#optionsbash) + * [options.cache](#optionscache) + * [options.dot](#optionsdot) + * [options.failglob](#optionsfailglob) + * [options.ignore](#optionsignore) + * [options.matchBase](#optionsmatchbase) + * [options.nocase](#optionsnocase) + * [options.nodupes](#optionsnodupes) + * [options.noglobstar](#optionsnoglobstar) + * [options.nonegate](#optionsnonegate) + * [options.nonull](#optionsnonull) + * [options.nullglob](#optionsnullglob) + * [options.slash](#optionsslash) + * [options.star](#optionsstar) + * [options.snapdragon](#optionssnapdragon) + * [options.sourcemap](#optionssourcemap) + * [options.unescape](#optionsunescape) + * [options.unixify](#optionsunixify) +- [Features](#features) +- [Bash expansion libs](#bash-expansion-libs) +- [Benchmarks](#benchmarks) + * [Running benchmarks](#running-benchmarks) + * [Nanomatch vs. Minimatch vs. Multimatch](#nanomatch-vs-minimatch-vs-multimatch) +- [About](#about) + +
+ +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save nanomatch +``` + +
+Release history + +## History + +### key + +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 +* `bumped`: updated dependencies, only minor or higher will be listed. + +### [1.1.0](https://github.com/micromatch/nanomatch/compare/1.0.4...1.1.0) - 2017-04-11 + +**Fixed** + +* adds support for unclosed quotes + +**Added** + +* adds support for `options.noglobstar` + +### [1.0.4](https://github.com/micromatch/nanomatch/compare/1.0.3...1.0.4) - 2017-04-06 + +Housekeeping updates. Adds documentation section about escaping, cleans up utils. + +### [1.0.3](https://github.com/micromatch/nanomatch/compare/1.0.1...1.0.3) - 2017-04-06 + +This release includes fixes for windows path edge cases and other improvements for stricter adherence to bash spec. + +**Fixed** + +* More windows path edge cases + +**Added** + +* Support for bash-like quoted strings for escaping sequences of characters, such as `foo/"**"/bar` where `**` should be matched literally and not evaluated as special characters. + +### [1.0.1](https://github.com/micromatch/nanomatch/compare/1.0.0...1.0.1) - 2016-12-12 + +**Added** + +* Support for windows path edge cases where backslashes are used in brackets or other unusual combinations. + +### [1.0.0](https://github.com/micromatch/nanomatch/compare/0.1.0...1.0.0) - 2016-12-12 + +Stable release. + +### [0.1.0] - 2016-10-08 + +First release. + +
+ +## What is nanomatch? + +Nanomatch is a fast and accurate glob matcher with full support for standard Bash glob features, including the following "metacharacters": `*`, `**`, `?` and `[...]`. + +**Learn more** + +* [Getting started](#getting-started): learn how to install and begin using nanomatch +* [Features](#features): jump to info about supported patterns, and a glob matching reference +* [API documentation](#api): jump to available options and methods +* [Unit tests](test): visit unit tests. there is no better way to learn a code library than spending time the unit tests. Nanomatch has 36,000 unit tests - go become a glob matching ninja! + +
+How is this different? + +**Speed and accuracy** + +Nanomatch uses [snapdragon](https://github.com/jonschlinkert/snapdragon) for parsing and compiling globs, which results in: + +* Granular control over the entire conversion process in a way that is easy to understand, reason about, and customize. +* Faster matching, from a combination of optimized glob patterns and (optional) caching. +* Much greater accuracy than minimatch. In fact, nanomatch passes _all of the spec tests_ from bash, including some that bash still fails. However, since there is no real specification for globs, if you encounter a pattern that yields unexpected match results [after researching previous issues](../../issues), [please let us know](../../issues/new). + +**Basic globbing only** + +Nanomatch supports [basic globbing only](#features), which is limited to `*`, `**`, `?` and regex-like brackets. + +If you need support for the other [bash "expansion" types](#bash-expansion-libs) (in addition to the wildcard matching provided by nanomatch), consider using [micromatch](https://github.com/micromatch/micromatch) instead. _(micromatch >=3.0.0 uses the nanomatch parser and compiler for basic glob matching)_ + +
+ +## Getting started + +### Installing nanomatch + +**Install with [yarn](https://yarnpkg.com/)** + +```sh +$ yarn add nanomatch +``` + +**Install with [npm](https://npmjs.com)** + +```sh +$ npm install nanomatch +``` + +### Usage + +Add nanomatch to your project using node's `require()` system: + +```js +var nanomatch = require('nanomatch'); + +// the main export is a function that takes an array of strings to match +// and a string or array of patterns to use for matching +nanomatch(list, patterns[, options]); +``` + +**Params** + +* `list` **{String|Array}**: List of strings to perform matches against. This is often a list of file paths. +* `patterns` **{String|Array}**: One or more [glob paterns](#features) to use for matching. +* `options` **{Object}**: Any [supported options](#options) may be passed + +**Examples** + +```js +var nm = require('nanomatch'); +console.log(nm(['a', 'b/b', 'c/c/c'], '*')); +//=> ['a'] + +console.log(nm(['a', 'b/b', 'c/c/c'], '*/*')); +//=> ['b/b'] + +console.log(nm(['a', 'b/b', 'c/c/c'], '**')); +//=> ['a', 'b/b', 'c/c/c'] +``` + +See the [API documentation](#api) for available methods and [options](https://github.com/einaros/options.js). + +## Documentation + +### Escaping + +_Backslashes and quotes_ can be used to escape characters, forcing nanomatch to regard those characters as a literal characters. + +**Backslashes** + +Use backslashes to escape single characters. For example, the following pattern would match `foo/*/bar` exactly: + +```js +'foo/\*/bar' +``` + +The following pattern would match `foo/` followed by a literal `*`, followed by zero or more of any characters besides `/`, followed by `/bar`. + +```js +'foo/\**/bar' +``` + +**Quoted strings** + +Use single or double quotes to escape sequences of characters. For example, the following patterns would match `foo/**/bar` exactly: + +```js +'foo/"**"/bar' +'foo/\'**\'/bar' +"foo/'**'/bar" +``` + +**Matching literal quotes** + +If you need to match quotes literally, you can escape them as well. For example, the following will match `foo/"*"/bar`, `foo/"a"/bar`, `foo/"b"/bar`, or `foo/"c"/bar`: + +```js +'foo/\\"*\\"/bar' +``` + +And the following will match `foo/'*'/bar`, `foo/'a'/bar`, `foo/'b'/bar`, or `foo/'c'/bar`: + +```js +'foo/\\\'*\\\'/bar' +``` + +## API + +### [nanomatch](index.js#L40) + +The main function takes a list of strings and one or more glob patterns to use for matching. + +**Params** + +* `list` **{Array}**: A list of strings to match +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Array}**: Returns an array of matches + +**Example** + +```js +var nm = require('nanomatch'); +nm(list, patterns[, options]); + +console.log(nm(['a.js', 'a.txt'], ['*.js'])); +//=> [ 'a.js' ] +``` + +### [.match](index.js#L106) + +Similar to the main function, but `pattern` must be a string. + +**Params** + +* `list` **{Array}**: Array of strings to match +* `pattern` **{String}**: Glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Array}**: Returns an array of matches + +**Example** + +```js +var nm = require('nanomatch'); +nm.match(list, pattern[, options]); + +console.log(nm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a')); +//=> ['a.a', 'a.aa'] +``` + +### [.isMatch](index.js#L167) + +Returns true if the specified `string` matches the given glob `pattern`. + +**Params** + +* `string` **{String}**: String to match +* `pattern` **{String}**: Glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if the string matches the glob pattern. + +**Example** + +```js +var nm = require('nanomatch'); +nm.isMatch(string, pattern[, options]); + +console.log(nm.isMatch('a.a', '*.a')); +//=> true +console.log(nm.isMatch('a.b', '*.a')); +//=> false +``` + +### [.some](index.js#L205) + +Returns true if some of the elements in the given `list` match any of the given glob `patterns`. + +**Params** + +* `list` **{String|Array}**: The string or array of strings to test. Returns as soon as the first match is found. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +var nm = require('nanomatch'); +nm.some(list, patterns[, options]); + +console.log(nm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); +// true +console.log(nm.some(['foo.js'], ['*.js', '!foo.js'])); +// false +``` + +### [.every](index.js#L243) + +Returns true if every element in the given `list` matches at least one of the given glob `patterns`. + +**Params** + +* `list` **{String|Array}**: The string or array of strings to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +var nm = require('nanomatch'); +nm.every(list, patterns[, options]); + +console.log(nm.every('foo.js', ['foo.js'])); +// true +console.log(nm.every(['foo.js', 'bar.js'], ['*.js'])); +// true +console.log(nm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); +// false +console.log(nm.every(['foo.js'], ['*.js', '!foo.js'])); +// false +``` + +### [.any](index.js#L277) + +Returns true if **any** of the given glob `patterns` match the specified `string`. + +**Params** + +* `str` **{String|Array}**: The string to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +var nm = require('nanomatch'); +nm.any(string, patterns[, options]); + +console.log(nm.any('a.a', ['b.*', '*.a'])); +//=> true +console.log(nm.any('a.a', 'b.*')); +//=> false +``` + +### [.all](index.js#L325) + +Returns true if **all** of the given `patterns` match the specified string. + +**Params** + +* `str` **{String|Array}**: The string to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +var nm = require('nanomatch'); +nm.all(string, patterns[, options]); + +console.log(nm.all('foo.js', ['foo.js'])); +// true + +console.log(nm.all('foo.js', ['*.js', '!foo.js'])); +// false + +console.log(nm.all('foo.js', ['*.js', 'foo.js'])); +// true + +console.log(nm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); +// true +``` + +### [.not](index.js#L359) + +Returns a list of strings that _**do not match any**_ of the given `patterns`. + +**Params** + +* `list` **{Array}**: Array of strings to match. +* `patterns` **{String|Array}**: One or more glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Array}**: Returns an array of strings that **do not match** the given patterns. + +**Example** + +```js +var nm = require('nanomatch'); +nm.not(list, patterns[, options]); + +console.log(nm.not(['a.a', 'b.b', 'c.c'], '*.a')); +//=> ['b.b', 'c.c'] +``` + +### [.contains](index.js#L394) + +Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string. + +**Params** + +* `str` **{String}**: The string to match. +* `patterns` **{String|Array}**: Glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if the patter matches any part of `str`. + +**Example** + +```js +var nm = require('nanomatch'); +nm.contains(string, pattern[, options]); + +console.log(nm.contains('aa/bb/cc', '*b')); +//=> true +console.log(nm.contains('aa/bb/cc', '*d')); +//=> false +``` + +### [.matchKeys](index.js#L450) + +Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead. + +**Params** + +* `object` **{Object}**: The object with keys to filter. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Object}**: Returns an object with only keys that match the given patterns. + +**Example** + +```js +var nm = require('nanomatch'); +nm.matchKeys(object, patterns[, options]); + +var obj = { aa: 'a', ab: 'b', ac: 'c' }; +console.log(nm.matchKeys(obj, '*b')); +//=> { ab: 'b' } +``` + +### [.matcher](index.js#L479) + +Returns a memoized matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match. + +**Params** + +* `pattern` **{String}**: Glob pattern +* `options` **{Object}**: See available [options](#options) for changing how matches are performed. +* `returns` **{Function}**: Returns a matcher function. + +**Example** + +```js +var nm = require('nanomatch'); +nm.matcher(pattern[, options]); + +var isMatch = nm.matcher('*.!(*a)'); +console.log(isMatch('a.a')); +//=> false +console.log(isMatch('a.b')); +//=> true +``` + +### [.capture](index.js#L560) + +Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match. + +**Params** + +* `pattern` **{String}**: Glob pattern to use for matching. +* `string` **{String}**: String to match +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns an array of captures if the string matches the glob pattern, otherwise `null`. + +**Example** + +```js +var nm = require('nanomatch'); +nm.capture(pattern, string[, options]); + +console.log(nm.capture('test/*.js', 'test/foo.js')); +//=> ['foo'] +console.log(nm.capture('test/*.js', 'foo/bar.css')); +//=> null +``` + +### [.makeRe](index.js#L595) + +Create a regular expression from the given glob `pattern`. + +**Params** + +* `pattern` **{String}**: A glob pattern to convert to regex. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed. +* `returns` **{RegExp}**: Returns a regex created from the given pattern. + +**Example** + +```js +var nm = require('nanomatch'); +nm.makeRe(pattern[, options]); + +console.log(nm.makeRe('*.js')); +//=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ +``` + +### [.create](index.js#L658) + +Parses the given glob `pattern` and returns an object with the compiled `output` and optional source `map`. + +**Params** + +* `pattern` **{String}**: Glob pattern to parse and compile. +* `options` **{Object}**: Any [options](#options) to change how parsing and compiling is performed. +* `returns` **{Object}**: Returns an object with the parsed AST, compiled string and optional source map. + +**Example** + +```js +var nm = require('nanomatch'); +nm.create(pattern[, options]); + +console.log(nm.create('abc/*.js')); +// { options: { source: 'string', sourcemap: true }, +// state: {}, +// compilers: +// { ... }, +// output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js', +// ast: +// { type: 'root', +// errors: [], +// nodes: +// [ ... ], +// dot: false, +// input: 'abc/*.js' }, +// parsingErrors: [], +// map: +// { version: 3, +// sources: [ 'string' ], +// names: [], +// mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE', +// sourcesContent: [ 'abc/*.js' ] }, +// position: { line: 1, column: 28 }, +// content: {}, +// files: {}, +// idx: 6 } +``` + +### [.parse](index.js#L697) + +Parse the given `str` with the given `options`. + +**Params** + +* `str` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an AST + +**Example** + +```js +var nm = require('nanomatch'); +nm.parse(pattern[, options]); + +var ast = nm.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: '' } ] } +``` + +### [.compile](index.js#L745) + +Compile the given `ast` or string with the given `options`. + +**Params** + +* `ast` **{Object|String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object that has an `output` property with the compiled string. + +**Example** + +```js +var nm = require('nanomatch'); +nm.compile(ast[, options]); + +var ast = nm.parse('a/{b,c}/d'); +console.log(nm.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: [] } +``` + +### [.clearCache](index.js#L768) + +Clear the regex cache. + +**Example** + +```js +nm.clearCache(); +``` + +## Options + +
+basename + +### options.basename + +Allow glob patterns without slashes to match a file path based on its basename. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `matchBase`. + +Type: `boolean` + +Default: `false` + +**Example** + +```js +nm(['a/b.js', 'a/c.md'], '*.js'); +//=> [] + +nm(['a/b.js', 'a/c.md'], '*.js', {matchBase: true}); +//=> ['a/b.js'] +``` + +
+ +
+bash + +### options.bash + +Enabled by default, this option enforces bash-like behavior with stars immediately following a bracket expression. Bash bracket expressions are similar to regex character classes, but unlike regex, a star following a bracket expression **does not repeat the bracketed characters**. Instead, the star is treated the same as an other star. + +Type: `boolean` + +Default: `true` + +**Example** + +```js +var files = ['abc', 'ajz']; +console.log(nm(files, '[a-c]*')); +//=> ['abc', 'ajz'] + +console.log(nm(files, '[a-c]*', {bash: false})); +``` + +
+ +
+cache + +### options.cache + +Disable regex and function memoization. + +Type: `boolean` + +Default: `undefined` + +
+ +
+dot + +### options.dot + +Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `dot`. + +Type: `boolean` + +Default: `false` + +
+ +
+failglob + +### options.failglob + +Similar to the `--failglob` behavior in Bash, throws an error when no matches are found. + +Type: `boolean` + +Default: `undefined` + +
+ +
+ignore + +### options.ignore + +String or array of glob patterns to match files to ignore. + +Type: `String|Array` + +Default: `undefined` + +
+ +
+matchBase + +### options.matchBase + +Alias for [options.basename](#options-basename). + +
+ +
+nocase + +### options.nocase + +Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +Type: `boolean` + +Default: `undefined` + +
+ +
+nodupes + +### options.nodupes + +Remove duplicate elements from the result array. + +Type: `boolean` + +Default: `true` (enabled by default) + +**Example** + +Example of using the `unescape` and `nodupes` options together: + +```js +nm.match(['a/b/c', 'a/b/c'], '**'); +//=> ['abc'] + +nm.match(['a/b/c', 'a/b/c'], '**', {nodupes: false}); +//=> ['a/b/c', 'a/b/c'] +``` + +
+ +
+nonegate + +### options.noglobstar + +Disable matching with globstars (`**`). + +Type: `boolean` + +Default: `undefined` + +```js +nm(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**'); +//=> ['a/b', 'a/b/c', 'a/b/c/d'] + +nm(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**', {noglobstar: true}); +//=> ['a/b'] +``` + +
+ +
+nonegate + +### options.nonegate + +Disallow negation (`!`) patterns, and treat leading `!` as a literal character to match. + +Type: `boolean` + +Default: `undefined` + +
+ +
+nonull + +### options.nonull + +Alias for [options.nullglob](#options-nullglob). + +
+ +
+nullglob + +### options.nullglob + +If `true`, when no matches are found the actual (arrayified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nonull`. + +Type: `boolean` + +Default: `undefined` + +
+ +
+slash + +### options.slash + +Customize the slash character(s) to use for matching. + +Type: `string|function` + +Default: `[/\\]` (forward slash and backslash) + +
+ +
+star + +### options.star + +Customize the star character(s) to use for matching. It's not recommended that you modify this unless you have advanced knowledge of the compiler and matching rules. + +Type: `string|function` + +Default: `[^/\\]*?` + +
+ +
+snapdragon + +### options.snapdragon + +Pass your own instance of [snapdragon](https://github.com/jonschlinkert/snapdragon) to customize parsers or compilers. + +Type: `object` + +Default: `undefined` + +
+ +
+snapdragon + +### options.sourcemap + +Generate a source map by enabling the `sourcemap` option with the `.parse`, `.compile`, or `.create` methods. + +**Examples** + +```js +var nm = require('nanomatch'); + +var res = nm.create('abc/*.js', {sourcemap: true}); +console.log(res.map); +// { version: 3, +// sources: [ 'string' ], +// names: [], +// mappings: 'AAAA,GAAG,EAAC,iBAAC,EAAC,EAAE', +// sourcesContent: [ 'abc/*.js' ] } + +var ast = nm.parse('abc/**/*.js'); +var res = nm.compile(ast, {sourcemap: true}); +console.log(res.map); +// { version: 3, +// sources: [ 'string' ], +// names: [], +// mappings: 'AAAA,GAAG,EAAC,2BAAE,EAAC,iBAAC,EAAC,EAAE', +// sourcesContent: [ 'abc/**/*.js' ] } +``` + +
+ +
+unescape + +### options.unescape + +Remove backslashes from returned matches. + +Type: `boolean` + +Default: `undefined` + +**Example** + +In this example we want to match a literal `*`: + +```js +nm.match(['abc', 'a\\*c'], 'a\\*c'); +//=> ['a\\*c'] + +nm.match(['abc', 'a\\*c'], 'a\\*c', {unescape: true}); +//=> ['a*c'] +``` + +
+ +
+unixify + +### options.unixify + +Convert path separators on returned files to posix/unix-style forward slashes. + +Type: `boolean` + +Default: `true` + +**Example** + +```js +nm.match(['a\\b\\c'], 'a/**'); +//=> ['a/b/c'] + +nm.match(['a\\b\\c'], {unixify: false}); +//=> ['a\\b\\c'] +``` + +
+ +## Features + +Nanomatch has full support for standard Bash glob features, including the following "metacharacters": `*`, `**`, `?` and `[...]`. + +Here are some examples of how they work: + +| **Pattern** | **Description** | +| --- | --- | +| `*` | Matches any string except for `/`, leading `.`, or `/.` inside a path | +| `**` | Matches any string including `/`, but not a leading `.` or `/.` inside a path. More than two stars (e.g. `***` is treated the same as one star, and `**` loses its special meaning | when it's not the only thing in a path segment, per Bash specifications) | +| `foo*` | Matches any string beginning with `foo` | +| `*bar*` | Matches any string containing `bar` (beginning, middle or end) | +| `*.min.js` | Matches any string ending with `.min.js` | +| `[abc]*.js` | Matches any string beginning with `a`, `b`, or `c` and ending with `.js` | +| `abc?` | Matches `abcd` or `abcz` but not `abcde` | + +The exceptions noted for `*` apply to all patterns that contain a `*`. + +**Not supported** + +The following extended-globbing features are not supported: + +* [brace expansion](https://github.com/jonschlinkert/braces) (e.g. `{a,b,c}`) +* [extglobs](https://github.com/jonschlinkert/extglob) (e.g. `@(a|!(c|d))`) +* [POSIX brackets](https://github.com/jonschlinkert/expand-brackets) (e.g. `[[:alpha:][:digit:]]`) + +If you need any of these features consider using [micromatch](https://github.com/micromatch/micromatch) instead. + +## Bash expansion libs + +Nanomatch is part of a suite of libraries aimed at bringing the power and expressiveness of [Bash's](https://www.gnu.org/software/bash/) matching and expansion capabilities to JavaScript, _and - as you can see by the [benchmarks](#benchmarks) - without sacrificing speed_. + +| **Related library** | **Matching Type** | **Example** | **Description** | +| --- | --- | --- | --- | +| `nanomatch` (you are here) | Wildcards | `*` | [Filename expansion](https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html#Filename-Expansion), also referred to as globbing and pathname expansion, allows the use of [wildcards](#features) for matching. | +| [expand-tilde](https://github.com/jonschlinkert/expand-tilde) | Tildes | `~` | [Tilde expansion](https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html#Tilde-Expansion) converts the leading tilde in a file path to the user home directory. | +| [braces](https://github.com/jonschlinkert/braces) | Braces | `{a,b,c}` | [Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) | +| [expand-brackets](https://github.com/jonschlinkert/expand-brackets) | Brackets | `[[:alpha:]]` | [POSIX character classes](https://www.gnu.org/software/grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html) (also referred to as POSIX brackets, or POSIX character classes) | +| [extglob](https://github.com/jonschlinkert/extglob) | Parens | `!(a\ | b)` | [Extglobs](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html#Pattern-Matching) | +| [micromatch](https://github.com/micromatch/micromatch) | All | all | Micromatch is built on top of the other libraries. | + +There are many resources available on the web if you want to dive deeper into how these features work in Bash. + +## Benchmarks + +### Running benchmarks + +Install dev dependencies: + +```bash +npm i -d && node benchmark +``` + +### Nanomatch vs. Minimatch vs. Multimatch + +```bash +# globstar-basic (182 bytes) + minimatch x 69,512 ops/sec ±1.92% (88 runs sampled) + multimatch x 63,376 ops/sec ±1.41% (89 runs sampled) + nanomatch x 432,451 ops/sec ±0.92% (88 runs sampled) + + fastest is nanomatch (by 651% avg) + +# large-list-globstar (485686 bytes) + minimatch x 34.02 ops/sec ±1.42% (59 runs sampled) + multimatch x 33.58 ops/sec ±1.97% (58 runs sampled) + nanomatch x 483 ops/sec ±1.06% (86 runs sampled) + + fastest is nanomatch (by 1429% avg) + +# long-list-globstar (194085 bytes) + minimatch x 383 ops/sec ±0.74% (90 runs sampled) + multimatch x 378 ops/sec ±0.59% (89 runs sampled) + nanomatch x 990 ops/sec ±1.14% (85 runs sampled) + + fastest is nanomatch (by 260% avg) + +# negation-basic (132 bytes) + minimatch x 242,145 ops/sec ±1.17% (89 runs sampled) + multimatch x 76,403 ops/sec ±0.78% (92 runs sampled) + nanomatch x 537,253 ops/sec ±1.44% (86 runs sampled) + + fastest is nanomatch (by 337% avg) + +# not-glob-basic (93 bytes) + minimatch x 252,402 ops/sec ±1.33% (89 runs sampled) + multimatch x 209,954 ops/sec ±1.30% (90 runs sampled) + nanomatch x 1,716,468 ops/sec ±1.13% (86 runs sampled) + + fastest is nanomatch (by 742% avg) + +# star-basic (93 bytes) + minimatch x 182,780 ops/sec ±1.41% (91 runs sampled) + multimatch x 153,210 ops/sec ±0.72% (89 runs sampled) + nanomatch x 599,621 ops/sec ±1.22% (90 runs sampled) + + fastest is nanomatch (by 357% avg) + +``` + +## 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. + +
+ +
+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: + +* [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.") +* [is-extglob](https://www.npmjs.com/package/is-extglob): Returns true if a string has an extglob. | [homepage](https://github.com/jonschlinkert/is-extglob "Returns true if a string has an extglob.") +* [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") +* [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.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 164 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [devongovett](https://github.com/devongovett) | + +### 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 18, 2018._ \ No newline at end of file diff --git a/node_modules/nanomatch/index.js b/node_modules/nanomatch/index.js new file mode 100644 index 00000000..dddc6128 --- /dev/null +++ b/node_modules/nanomatch/index.js @@ -0,0 +1,838 @@ +'use strict'; + +/** + * Module dependencies + */ + +var util = require('util'); +var toRegex = require('to-regex'); +var extend = require('extend-shallow'); + +/** + * Local dependencies + */ + +var compilers = require('./lib/compilers'); +var parsers = require('./lib/parsers'); +var cache = require('./lib/cache'); +var utils = require('./lib/utils'); +var MAX_LENGTH = 1024 * 64; + +/** + * The main function takes a list of strings and one or more + * glob patterns to use for matching. + * + * ```js + * var nm = require('nanomatch'); + * nm(list, patterns[, options]); + * + * console.log(nm(['a.js', 'a.txt'], ['*.js'])); + * //=> [ 'a.js' ] + * ``` + * @param {Array} `list` A list of strings to match + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of matches + * @summary false + * @api public + */ + +function nanomatch(list, patterns, options) { + patterns = utils.arrayify(patterns); + list = utils.arrayify(list); + + var len = patterns.length; + if (list.length === 0 || len === 0) { + return []; + } + + if (len === 1) { + return nanomatch.match(list, patterns[0], options); + } + + var negated = false; + var omit = []; + var keep = []; + var idx = -1; + + while (++idx < len) { + var pattern = patterns[idx]; + + if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33 /* ! */) { + omit.push.apply(omit, nanomatch.match(list, pattern.slice(1), options)); + negated = true; + } else { + keep.push.apply(keep, nanomatch.match(list, pattern, options)); + } + } + + // minimatch.match parity + if (negated && keep.length === 0) { + if (options && options.unixify === false) { + keep = list.slice(); + } else { + var unixify = utils.unixify(options); + for (var i = 0; i < list.length; i++) { + keep.push(unixify(list[i])); + } + } + } + + var matches = utils.diff(keep, omit); + if (!options || options.nodupes !== false) { + return utils.unique(matches); + } + + return matches; +} + +/** + * Similar to the main function, but `pattern` must be a string. + * + * ```js + * var nm = require('nanomatch'); + * nm.match(list, pattern[, options]); + * + * console.log(nm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a')); + * //=> ['a.a', 'a.aa'] + * ``` + * @param {Array} `list` Array of strings to match + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of matches + * @api public + */ + +nanomatch.match = function(list, pattern, options) { + if (Array.isArray(pattern)) { + throw new TypeError('expected pattern to be a string'); + } + + var unixify = utils.unixify(options); + var isMatch = memoize('match', pattern, options, nanomatch.matcher); + var matches = []; + + list = utils.arrayify(list); + var len = list.length; + var idx = -1; + + while (++idx < len) { + var ele = list[idx]; + if (ele === pattern || isMatch(ele)) { + matches.push(utils.value(ele, unixify, options)); + } + } + + // if no options were passed, uniquify results and return + if (typeof options === 'undefined') { + return utils.unique(matches); + } + + if (matches.length === 0) { + if (options.failglob === true) { + throw new Error('no matches found for "' + pattern + '"'); + } + if (options.nonull === true || options.nullglob === true) { + return [options.unescape ? utils.unescape(pattern) : pattern]; + } + } + + // if `opts.ignore` was defined, diff ignored list + if (options.ignore) { + matches = nanomatch.not(matches, options.ignore, options); + } + + return options.nodupes !== false ? utils.unique(matches) : matches; +}; + +/** + * Returns true if the specified `string` matches the given glob `pattern`. + * + * ```js + * var nm = require('nanomatch'); + * nm.isMatch(string, pattern[, options]); + * + * console.log(nm.isMatch('a.a', '*.a')); + * //=> true + * console.log(nm.isMatch('a.b', '*.a')); + * //=> false + * ``` + * @param {String} `string` String to match + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the string matches the glob pattern. + * @api public + */ + +nanomatch.isMatch = function(str, pattern, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (utils.isEmptyString(str) || utils.isEmptyString(pattern)) { + return false; + } + + var equals = utils.equalsPattern(options); + if (equals(str)) { + return true; + } + + var isMatch = memoize('isMatch', pattern, options, nanomatch.matcher); + return isMatch(str); +}; + +/** + * Returns true if some of the elements in the given `list` match any of the + * given glob `patterns`. + * + * ```js + * var nm = require('nanomatch'); + * nm.some(list, patterns[, options]); + * + * console.log(nm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // true + * console.log(nm.some(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +nanomatch.some = function(list, patterns, options) { + if (typeof list === 'string') { + list = [list]; + } + + for (var i = 0; i < list.length; i++) { + if (nanomatch(list[i], patterns, options).length === 1) { + return true; + } + } + + return false; +}; + +/** + * Returns true if every element in the given `list` matches + * at least one of the given glob `patterns`. + * + * ```js + * var nm = require('nanomatch'); + * nm.every(list, patterns[, options]); + * + * console.log(nm.every('foo.js', ['foo.js'])); + * // true + * console.log(nm.every(['foo.js', 'bar.js'], ['*.js'])); + * // true + * console.log(nm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // false + * console.log(nm.every(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +nanomatch.every = function(list, patterns, options) { + if (typeof list === 'string') { + list = [list]; + } + + for (var i = 0; i < list.length; i++) { + if (nanomatch(list[i], patterns, options).length !== 1) { + return false; + } + } + + return true; +}; + +/** + * Returns true if **any** of the given glob `patterns` + * match the specified `string`. + * + * ```js + * var nm = require('nanomatch'); + * nm.any(string, patterns[, options]); + * + * console.log(nm.any('a.a', ['b.*', '*.a'])); + * //=> true + * console.log(nm.any('a.a', 'b.*')); + * //=> false + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +nanomatch.any = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) { + return false; + } + + if (typeof patterns === 'string') { + patterns = [patterns]; + } + + for (var i = 0; i < patterns.length; i++) { + if (nanomatch.isMatch(str, patterns[i], options)) { + return true; + } + } + return false; +}; + +/** + * Returns true if **all** of the given `patterns` + * match the specified string. + * + * ```js + * var nm = require('nanomatch'); + * nm.all(string, patterns[, options]); + * + * console.log(nm.all('foo.js', ['foo.js'])); + * // true + * + * console.log(nm.all('foo.js', ['*.js', '!foo.js'])); + * // false + * + * console.log(nm.all('foo.js', ['*.js', 'foo.js'])); + * // true + * + * console.log(nm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); + * // true + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +nanomatch.all = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (typeof patterns === 'string') { + patterns = [patterns]; + } + + for (var i = 0; i < patterns.length; i++) { + if (!nanomatch.isMatch(str, patterns[i], options)) { + return false; + } + } + return true; +}; + +/** + * Returns a list of strings that _**do not match any**_ of the given `patterns`. + * + * ```js + * var nm = require('nanomatch'); + * nm.not(list, patterns[, options]); + * + * console.log(nm.not(['a.a', 'b.b', 'c.c'], '*.a')); + * //=> ['b.b', 'c.c'] + * ``` + * @param {Array} `list` Array of strings to match. + * @param {String|Array} `patterns` One or more glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of strings that **do not match** the given patterns. + * @api public + */ + +nanomatch.not = function(list, patterns, options) { + var opts = extend({}, options); + var ignore = opts.ignore; + delete opts.ignore; + + list = utils.arrayify(list); + + var matches = utils.diff(list, nanomatch(list, patterns, opts)); + if (ignore) { + matches = utils.diff(matches, nanomatch(list, ignore)); + } + + return opts.nodupes !== false ? utils.unique(matches) : matches; +}; + +/** + * Returns true if the given `string` contains the given pattern. Similar + * to [.isMatch](#isMatch) but the pattern can match any part of the string. + * + * ```js + * var nm = require('nanomatch'); + * nm.contains(string, pattern[, options]); + * + * console.log(nm.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(nm.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String|Array} `patterns` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the patter matches any part of `str`. + * @api public + */ + +nanomatch.contains = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (typeof patterns === 'string') { + if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) { + return false; + } + + var equals = utils.equalsPattern(patterns, options); + if (equals(str)) { + return true; + } + var contains = utils.containsPattern(patterns, options); + if (contains(str)) { + return true; + } + } + + var opts = extend({}, options, {contains: true}); + return nanomatch.any(str, patterns, opts); +}; + +/** + * Returns true if the given pattern and options should enable + * the `matchBase` option. + * @return {Boolean} + * @api private + */ + +nanomatch.matchBase = function(pattern, options) { + if (pattern && pattern.indexOf('/') !== -1 || !options) return false; + return options.basename === true || options.matchBase === true; +}; + +/** + * Filter the keys of the given object with the given `glob` pattern + * and `options`. Does not attempt to match nested keys. If you need this feature, + * use [glob-object][] instead. + * + * ```js + * var nm = require('nanomatch'); + * nm.matchKeys(object, patterns[, options]); + * + * var obj = { aa: 'a', ab: 'b', ac: 'c' }; + * console.log(nm.matchKeys(obj, '*b')); + * //=> { ab: 'b' } + * ``` + * @param {Object} `object` The object with keys to filter. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Object} Returns an object with only keys that match the given patterns. + * @api public + */ + +nanomatch.matchKeys = function(obj, patterns, options) { + if (!utils.isObject(obj)) { + throw new TypeError('expected the first argument to be an object'); + } + var keys = nanomatch(Object.keys(obj), patterns, options); + return utils.pick(obj, keys); +}; + +/** + * Returns a memoized matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns + * true if the string is a match. + * + * ```js + * var nm = require('nanomatch'); + * nm.matcher(pattern[, options]); + * + * var isMatch = nm.matcher('*.!(*a)'); + * console.log(isMatch('a.a')); + * //=> false + * console.log(isMatch('a.b')); + * //=> true + * ``` + * @param {String} `pattern` Glob pattern + * @param {Object} `options` See available [options](#options) for changing how matches are performed. + * @return {Function} Returns a matcher function. + * @api public + */ + +nanomatch.matcher = function matcher(pattern, options) { + if (utils.isEmptyString(pattern)) { + return function() { + return false; + }; + } + + if (Array.isArray(pattern)) { + return compose(pattern, options, matcher); + } + + // if pattern is a regex + if (pattern instanceof RegExp) { + return test(pattern); + } + + // if pattern is invalid + if (!utils.isString(pattern)) { + throw new TypeError('expected pattern to be an array, string or regex'); + } + + // if pattern is a non-glob string + if (!utils.hasSpecialChars(pattern)) { + if (options && options.nocase === true) { + pattern = pattern.toLowerCase(); + } + return utils.matchPath(pattern, options); + } + + // if pattern is a glob string + var re = nanomatch.makeRe(pattern, options); + + // if `options.matchBase` or `options.basename` is defined + if (nanomatch.matchBase(pattern, options)) { + return utils.matchBasename(re, options); + } + + function test(regex) { + var equals = utils.equalsPattern(options); + var unixify = utils.unixify(options); + + return function(str) { + if (equals(str)) { + return true; + } + + if (regex.test(unixify(str))) { + return true; + } + return false; + }; + } + + // create matcher function + var matcherFn = test(re); + // set result object from compiler on matcher function, + // as a non-enumerable property. useful for debugging + utils.define(matcherFn, 'result', re.result); + return matcherFn; +}; + +/** + * Returns an array of matches captured by `pattern` in `string, or + * `null` if the pattern did not match. + * + * ```js + * var nm = require('nanomatch'); + * nm.capture(pattern, string[, options]); + * + * console.log(nm.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(nm.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `pattern` Glob pattern to use for matching. + * @param {String} `string` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`. + * @api public + */ + +nanomatch.capture = function(pattern, str, options) { + var re = nanomatch.makeRe(pattern, extend({capture: true}, options)); + var unixify = utils.unixify(options); + + function match() { + return function(string) { + var match = re.exec(unixify(string)); + if (!match) { + return null; + } + + return match.slice(1); + }; + } + + var capture = memoize('capture', pattern, options, match); + return capture(str); +}; + +/** + * Create a regular expression from the given glob `pattern`. + * + * ```js + * var nm = require('nanomatch'); + * nm.makeRe(pattern[, options]); + * + * console.log(nm.makeRe('*.js')); + * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ + * ``` + * @param {String} `pattern` A glob pattern to convert to regex. + * @param {Object} `options` See available [options](#options) for changing how matches are performed. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +nanomatch.makeRe = function(pattern, options) { + if (pattern instanceof RegExp) { + return pattern; + } + + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + function makeRe() { + var opts = utils.extend({wrap: false}, options); + var result = nanomatch.create(pattern, opts); + var regex = toRegex(result.output, opts); + utils.define(regex, 'result', result); + return regex; + } + + return memoize('makeRe', pattern, options, makeRe); +}; + +/** + * Parses the given glob `pattern` and returns an object with the compiled `output` + * and optional source `map`. + * + * ```js + * var nm = require('nanomatch'); + * nm.create(pattern[, options]); + * + * console.log(nm.create('abc/*.js')); + * // { options: { source: 'string', sourcemap: true }, + * // state: {}, + * // compilers: + * // { ... }, + * // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js', + * // ast: + * // { type: 'root', + * // errors: [], + * // nodes: + * // [ ... ], + * // dot: false, + * // input: 'abc/*.js' }, + * // parsingErrors: [], + * // map: + * // { version: 3, + * // sources: [ 'string' ], + * // names: [], + * // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE', + * // sourcesContent: [ 'abc/*.js' ] }, + * // position: { line: 1, column: 28 }, + * // content: {}, + * // files: {}, + * // idx: 6 } + * ``` + * @param {String} `pattern` Glob pattern to parse and compile. + * @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed. + * @return {Object} Returns an object with the parsed AST, compiled string and optional source map. + * @api public + */ + +nanomatch.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + function create() { + return nanomatch.compile(nanomatch.parse(pattern, options), options); + } + return memoize('create', pattern, options, create); +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * var nm = require('nanomatch'); + * nm.parse(pattern[, options]); + * + * var ast = nm.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} `str` + * @param {Object} `options` + * @return {Object} Returns an AST + * @api public + */ + +nanomatch.parse = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + function parse() { + var snapdragon = utils.instantiate(null, options); + parsers(snapdragon, options); + + var ast = snapdragon.parse(pattern, options); + utils.define(ast, 'snapdragon', snapdragon); + ast.input = pattern; + return ast; + } + + return memoize('parse', pattern, options, parse); +}; + +/** + * Compile the given `ast` or string with the given `options`. + * + * ```js + * var nm = require('nanomatch'); + * nm.compile(ast[, options]); + * + * var ast = nm.parse('a/{b,c}/d'); + * console.log(nm.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` + * @param {Object} `options` + * @return {Object} Returns an object that has an `output` property with the compiled string. + * @api public + */ + +nanomatch.compile = function(ast, options) { + if (typeof ast === 'string') { + ast = nanomatch.parse(ast, options); + } + + function compile() { + var snapdragon = utils.instantiate(ast, options); + compilers(snapdragon, options); + return snapdragon.compile(ast, options); + } + + return memoize('compile', ast.input, options, compile); +}; + +/** + * Clear the regex cache. + * + * ```js + * nm.clearCache(); + * ``` + * @api public + */ + +nanomatch.clearCache = function() { + nanomatch.cache.__data__ = {}; +}; + +/** + * Compose a matcher function with the given patterns. + * This allows matcher functions to be compiled once and + * called multiple times. + */ + +function compose(patterns, options, matcher) { + var matchers; + + return memoize('compose', String(patterns), options, function() { + return function(file) { + // delay composition until it's invoked the first time, + // after that it won't be called again + if (!matchers) { + matchers = []; + for (var i = 0; i < patterns.length; i++) { + matchers.push(matcher(patterns[i], options)); + } + } + + var len = matchers.length; + while (len--) { + if (matchers[len](file) === true) { + return true; + } + } + return false; + }; + }); +} + +/** + * Memoize a generated regex or function. A unique key is generated + * from the `type` (usually method name), the `pattern`, and + * user-defined options. + */ + +function memoize(type, pattern, options, fn) { + var key = utils.createKey(type + '=' + pattern, options); + + if (options && options.cache === false) { + return fn(pattern, options); + } + + if (cache.has(type, key)) { + return cache.get(type, key); + } + + var val = fn(pattern, options); + cache.set(type, key, val); + return val; +} + +/** + * Expose compiler, parser and cache on `nanomatch` + */ + +nanomatch.compilers = compilers; +nanomatch.parsers = parsers; +nanomatch.cache = cache; + +/** + * Expose `nanomatch` + * @type {Function} + */ + +module.exports = nanomatch; diff --git a/node_modules/nanomatch/lib/cache.js b/node_modules/nanomatch/lib/cache.js new file mode 100644 index 00000000..fffc4c17 --- /dev/null +++ b/node_modules/nanomatch/lib/cache.js @@ -0,0 +1 @@ +module.exports = new (require('fragment-cache'))(); diff --git a/node_modules/nanomatch/lib/compilers.js b/node_modules/nanomatch/lib/compilers.js new file mode 100644 index 00000000..d7a786e7 --- /dev/null +++ b/node_modules/nanomatch/lib/compilers.js @@ -0,0 +1,339 @@ +'use strict'; + +/** +* Nanomatch compilers +*/ + +module.exports = function(nanomatch, options) { + function slash() { + if (options && typeof options.slash === 'string') { + return options.slash; + } + if (options && typeof options.slash === 'function') { + return options.slash.call(nanomatch); + } + return '\\\\/'; + } + + function star() { + if (options && typeof options.star === 'string') { + return options.star; + } + if (options && typeof options.star === 'function') { + return options.star.call(nanomatch); + } + return '[^' + slash() + ']*?'; + } + + var ast = nanomatch.ast = nanomatch.parser.ast; + ast.state = nanomatch.parser.state; + nanomatch.compiler.state = ast.state; + nanomatch.compiler + + /** + * Negation / escaping + */ + + .set('not', function(node) { + var prev = this.prev(); + if (this.options.nonegate === true || prev.type !== 'bos') { + return this.emit('\\' + node.val, node); + } + return this.emit(node.val, node); + }) + .set('escape', function(node) { + if (this.options.unescape && /^[-\w_.]/.test(node.val)) { + return this.emit(node.val, node); + } + return this.emit('\\' + node.val, node); + }) + .set('quoted', function(node) { + return this.emit(node.val, node); + }) + + /** + * Regex + */ + + .set('dollar', function(node) { + if (node.parent.type === 'bracket') { + return this.emit(node.val, node); + } + return this.emit('\\' + node.val, node); + }) + + /** + * Dot: "." + */ + + .set('dot', function(node) { + if (node.dotfiles === true) this.dotfiles = true; + return this.emit('\\' + node.val, node); + }) + + /** + * Slashes: "/" and "\" + */ + + .set('backslash', function(node) { + return this.emit(node.val, node); + }) + .set('slash', function(node, nodes, i) { + var val = '[' + slash() + ']'; + var parent = node.parent; + var prev = this.prev(); + + // set "node.hasSlash" to true on all ancestor parens nodes + while (parent.type === 'paren' && !parent.hasSlash) { + parent.hasSlash = true; + parent = parent.parent; + } + + if (prev.addQmark) { + val += '?'; + } + + // word boundary + if (node.rest.slice(0, 2) === '\\b') { + return this.emit(val, node); + } + + // globstars + if (node.parsed === '**' || node.parsed === './**') { + this.output = '(?:' + this.output; + return this.emit(val + ')?', node); + } + + // negation + if (node.parsed === '!**' && this.options.nonegate !== true) { + return this.emit(val + '?\\b', node); + } + return this.emit(val, node); + }) + + /** + * Square brackets + */ + + .set('bracket', function(node) { + var close = node.close; + var open = !node.escaped ? '[' : '\\['; + var negated = node.negated; + var inner = node.inner; + var val = node.val; + + if (node.escaped === true) { + inner = inner.replace(/\\?(\W)/g, '\\$1'); + negated = ''; + } + + if (inner === ']-') { + inner = '\\]\\-'; + } + + if (negated && inner.indexOf('.') === -1) { + inner += '.'; + } + if (negated && inner.indexOf('/') === -1) { + inner += '/'; + } + + val = open + negated + inner + close; + return this.emit(val, node); + }) + + /** + * Square: "[.]" (only matches a single character in brackets) + */ + + .set('square', function(node) { + var val = (/^\W/.test(node.val) ? '\\' : '') + node.val; + return this.emit(val, node); + }) + + /** + * Question mark: "?" + */ + + .set('qmark', function(node) { + var prev = this.prev(); + // don't use "slash" variable so that we always avoid + // matching backslashes and slashes with a qmark + var val = '[^.\\\\/]'; + if (this.options.dot || (prev.type !== 'bos' && prev.type !== 'slash')) { + val = '[^\\\\/]'; + } + + if (node.parsed.slice(-1) === '(') { + var ch = node.rest.charAt(0); + if (ch === '!' || ch === '=' || ch === ':') { + return this.emit(node.val, node); + } + } + + if (node.val.length > 1) { + val += '{' + node.val.length + '}'; + } + return this.emit(val, node); + }) + + /** + * Plus + */ + + .set('plus', function(node) { + var prev = node.parsed.slice(-1); + if (prev === ']' || prev === ')') { + return this.emit(node.val, node); + } + if (!this.output || (/[?*+]/.test(ch) && node.parent.type !== 'bracket')) { + return this.emit('\\+', node); + } + var ch = this.output.slice(-1); + if (/\w/.test(ch) && !node.inside) { + return this.emit('+\\+?', node); + } + return this.emit('+', node); + }) + + /** + * globstar: '**' + */ + + .set('globstar', function(node, nodes, i) { + if (!this.output) { + this.state.leadingGlobstar = true; + } + + var prev = this.prev(); + var before = this.prev(2); + var next = this.next(); + var after = this.next(2); + var type = prev.type; + var val = node.val; + + if (prev.type === 'slash' && next.type === 'slash') { + if (before.type === 'text') { + this.output += '?'; + + if (after.type !== 'text') { + this.output += '\\b'; + } + } + } + + var parsed = node.parsed; + if (parsed.charAt(0) === '!') { + parsed = parsed.slice(1); + } + + var isInside = node.isInside.paren || node.isInside.brace; + if (parsed && type !== 'slash' && type !== 'bos' && !isInside) { + val = star(); + } else { + val = this.options.dot !== true + ? '(?:(?!(?:[' + slash() + ']|^)\\.).)*?' + : '(?:(?!(?:[' + slash() + ']|^)(?:\\.{1,2})($|[' + slash() + ']))(?!\\.{2}).)*?'; + } + + if ((type === 'slash' || type === 'bos') && this.options.dot !== true) { + val = '(?!\\.)' + val; + } + + if (prev.type === 'slash' && next.type === 'slash' && before.type !== 'text') { + if (after.type === 'text' || after.type === 'star') { + node.addQmark = true; + } + } + + if (this.options.capture) { + val = '(' + val + ')'; + } + + return this.emit(val, node); + }) + + /** + * Star: "*" + */ + + .set('star', function(node, nodes, i) { + var prior = nodes[i - 2] || {}; + var prev = this.prev(); + var next = this.next(); + var type = prev.type; + + function isStart(n) { + return n.type === 'bos' || n.type === 'slash'; + } + + if (this.output === '' && this.options.contains !== true) { + this.output = '(?![' + slash() + '])'; + } + + if (type === 'bracket' && this.options.bash === false) { + var str = next && next.type === 'bracket' ? star() : '*?'; + if (!prev.nodes || prev.nodes[1].type !== 'posix') { + return this.emit(str, node); + } + } + + var prefix = !this.dotfiles && type !== 'text' && type !== 'escape' + ? (this.options.dot ? '(?!(?:^|[' + slash() + '])\\.{1,2}(?:$|[' + slash() + ']))' : '(?!\\.)') + : ''; + + if (isStart(prev) || (isStart(prior) && type === 'not')) { + if (prefix !== '(?!\\.)') { + prefix += '(?!(\\.{2}|\\.[' + slash() + ']))(?=.)'; + } else { + prefix += '(?=.)'; + } + } else if (prefix === '(?!\\.)') { + prefix = ''; + } + + if (prev.type === 'not' && prior.type === 'bos' && this.options.dot === true) { + this.output = '(?!\\.)' + this.output; + } + + var output = prefix + star(); + if (this.options.capture) { + output = '(' + output + ')'; + } + + return this.emit(output, node); + }) + + /** + * Text + */ + + .set('text', function(node) { + return this.emit(node.val, node); + }) + + /** + * End-of-string + */ + + .set('eos', function(node) { + var prev = this.prev(); + var val = node.val; + + this.output = '(?:\\.[' + slash() + '](?=.))?' + this.output; + if (this.state.metachar && prev.type !== 'qmark' && prev.type !== 'slash') { + val += (this.options.contains ? '[' + slash() + ']?' : '(?:[' + slash() + ']|$)'); + } + + return this.emit(val, node); + }); + + /** + * Allow custom compilers to be passed on options + */ + + if (options && typeof options.compilers === 'function') { + options.compilers(nanomatch.compiler); + } +}; + diff --git a/node_modules/nanomatch/lib/parsers.js b/node_modules/nanomatch/lib/parsers.js new file mode 100644 index 00000000..f87df8f3 --- /dev/null +++ b/node_modules/nanomatch/lib/parsers.js @@ -0,0 +1,386 @@ +'use strict'; + +var regexNot = require('regex-not'); +var toRegex = require('to-regex'); + +/** + * Characters to use in negation regex (we want to "not" match + * characters that are matched by other parsers) + */ + +var cached; +var NOT_REGEX = '[\\[!*+?$^"\'.\\\\/]+'; +var not = createTextRegex(NOT_REGEX); + +/** + * Nanomatch parsers + */ + +module.exports = function(nanomatch, options) { + var parser = nanomatch.parser; + var opts = parser.options; + + parser.state = { + slashes: 0, + paths: [] + }; + + parser.ast.state = parser.state; + parser + + /** + * Beginning-of-string + */ + + .capture('prefix', function() { + if (this.parsed) return; + var m = this.match(/^\.[\\/]/); + if (!m) return; + this.state.strictOpen = !!this.options.strictOpen; + this.state.addPrefix = true; + }) + + /** + * Escape: "\\." + */ + + .capture('escape', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(/^(?:\\(.)|([$^]))/); + if (!m) return; + + return pos({ + type: 'escape', + val: m[2] || m[1] + }); + }) + + /** + * Quoted strings + */ + + .capture('quoted', function() { + var pos = this.position(); + var m = this.match(/^["']/); + if (!m) return; + + var quote = m[0]; + if (this.input.indexOf(quote) === -1) { + return pos({ + type: 'escape', + val: quote + }); + } + + var tok = advanceTo(this.input, quote); + this.consume(tok.len); + + return pos({ + type: 'quoted', + val: tok.esc + }); + }) + + /** + * Negations: "!" + */ + + .capture('not', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(this.notRegex || /^!+/); + if (!m) return; + var val = m[0]; + + var isNegated = (val.length % 2) === 1; + if (parsed === '' && !isNegated) { + val = ''; + } + + // if nothing has been parsed, we know `!` is at the start, + // so we need to wrap the result in a negation regex + if (parsed === '' && isNegated && this.options.nonegate !== true) { + this.bos.val = '(?!^(?:'; + this.append = ')$).*'; + val = ''; + } + return pos({ + type: 'not', + val: val + }); + }) + + /** + * Dot: "." + */ + + .capture('dot', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\.+/); + if (!m) return; + + var val = m[0]; + this.state.dot = val === '.' && (parsed === '' || parsed.slice(-1) === '/'); + + return pos({ + type: 'dot', + dotfiles: this.state.dot, + val: val + }); + }) + + /** + * Plus: "+" + */ + + .capture('plus', /^\+(?!\()/) + + /** + * Question mark: "?" + */ + + .capture('qmark', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\?+(?!\()/); + if (!m) return; + + this.state.metachar = true; + this.state.qmark = true; + + return pos({ + type: 'qmark', + parsed: parsed, + val: m[0] + }); + }) + + /** + * Globstar: "**" + */ + + .capture('globstar', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\*{2}(?![*(])(?=[,)/]|$)/); + if (!m) return; + + var type = opts.noglobstar !== true ? 'globstar' : 'star'; + var node = pos({type: type, parsed: parsed}); + this.state.metachar = true; + + while (this.input.slice(0, 4) === '/**/') { + this.input = this.input.slice(3); + } + + node.isInside = { + brace: this.isInside('brace'), + paren: this.isInside('paren') + }; + + if (type === 'globstar') { + this.state.globstar = true; + node.val = '**'; + + } else { + this.state.star = true; + node.val = '*'; + } + + return node; + }) + + /** + * Star: "*" + */ + + .capture('star', function() { + var pos = this.position(); + var starRe = /^(?:\*(?![*(])|[*]{3,}(?!\()|[*]{2}(?![(/]|$)|\*(?=\*\())/; + var m = this.match(starRe); + if (!m) return; + + this.state.metachar = true; + this.state.star = true; + return pos({ + type: 'star', + val: m[0] + }); + }) + + /** + * Slash: "/" + */ + + .capture('slash', function() { + var pos = this.position(); + var m = this.match(/^\//); + if (!m) return; + + this.state.slashes++; + return pos({ + type: 'slash', + val: m[0] + }); + }) + + /** + * Backslash: "\\" + */ + + .capture('backslash', function() { + var pos = this.position(); + var m = this.match(/^\\(?![*+?(){}[\]'"])/); + if (!m) return; + + var val = m[0]; + + if (this.isInside('bracket')) { + val = '\\'; + } else if (val.length > 1) { + val = '\\\\'; + } + + return pos({ + type: 'backslash', + val: val + }); + }) + + /** + * Square: "[.]" + */ + + .capture('square', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(/^\[([^!^\\])\]/); + if (!m) return; + + return pos({ + type: 'square', + val: m[1] + }); + }) + + /** + * Brackets: "[...]" (basic, this can be overridden by other parsers) + */ + + .capture('bracket', function() { + var pos = this.position(); + var m = this.match(/^(?:\[([!^]?)([^\]]+|\]-)(\]|[^*+?]+)|\[)/); + if (!m) return; + + var val = m[0]; + var negated = m[1] ? '^' : ''; + var inner = (m[2] || '').replace(/\\\\+/, '\\\\'); + var close = m[3] || ''; + + if (m[2] && inner.length < m[2].length) { + val = val.replace(/\\\\+/, '\\\\'); + } + + 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({ + type: 'bracket', + val: val, + escaped: close !== ']', + negated: negated, + inner: inner, + close: close + }); + }) + + /** + * Text + */ + + .capture('text', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(not); + if (!m || !m[0]) return; + + return pos({ + type: 'text', + val: m[0] + }); + }); + + /** + * Allow custom parsers to be passed on options + */ + + if (options && typeof options.parsers === 'function') { + options.parsers(nanomatch.parser); + } +}; + +/** + * Advance to the next non-escaped character + */ + +function advanceTo(input, endChar) { + var ch = input.charAt(0); + var tok = { len: 1, val: '', esc: '' }; + var idx = 0; + + function advance() { + if (ch !== '\\') { + tok.esc += '\\' + ch; + tok.val += ch; + } + + ch = input.charAt(++idx); + tok.len++; + + if (ch === '\\') { + advance(); + advance(); + } + } + + while (ch && ch !== endChar) { + advance(); + } + return tok; +} + +/** + * Create text regex + */ + +function createTextRegex(pattern) { + if (cached) return cached; + var opts = {contains: true, strictClose: false}; + var not = regexNot.create(pattern, opts); + var re = toRegex('^(?:[*]\\((?=.)|' + not + ')', opts); + return (cached = re); +} + +/** + * Expose negation string + */ + +module.exports.not = NOT_REGEX; diff --git a/node_modules/nanomatch/lib/utils.js b/node_modules/nanomatch/lib/utils.js new file mode 100644 index 00000000..0cf1501d --- /dev/null +++ b/node_modules/nanomatch/lib/utils.js @@ -0,0 +1,379 @@ +'use strict'; + +var utils = module.exports; +var path = require('path'); + +/** + * Module dependencies + */ + +var isWindows = require('is-windows')(); +var Snapdragon = require('snapdragon'); +utils.define = require('define-property'); +utils.diff = require('arr-diff'); +utils.extend = require('extend-shallow'); +utils.pick = require('object.pick'); +utils.typeOf = require('kind-of'); +utils.unique = require('array-unique'); + +/** + * Returns true if the given value is effectively an empty string + */ + +utils.isEmptyString = function(val) { + return String(val) === '' || String(val) === './'; +}; + +/** + * Returns true if the platform is windows, or `path.sep` is `\\`. + * This is defined as a function to allow `path.sep` to be set in unit tests, + * or by the user, if there is a reason to do so. + * @return {Boolean} + */ + +utils.isWindows = function() { + return path.sep === '\\' || isWindows === true; +}; + +/** + * Return the last element from an array + */ + +utils.last = function(arr, n) { + return arr[arr.length - (n || 1)]; +}; + +/** + * Get the `Snapdragon` instance to use + */ + +utils.instantiate = function(ast, options) { + var snapdragon; + // if an instance was created by `.parse`, use that instance + if (utils.typeOf(ast) === 'object' && ast.snapdragon) { + snapdragon = ast.snapdragon; + // if the user supplies an instance on options, use that instance + } else if (utils.typeOf(options) === 'object' && options.snapdragon) { + snapdragon = options.snapdragon; + // create a new instance + } else { + snapdragon = new Snapdragon(options); + } + + utils.define(snapdragon, 'parse', function(str, options) { + var parsed = Snapdragon.prototype.parse.call(this, str, options); + parsed.input = str; + + // escape unmatched brace/bracket/parens + var last = this.parser.stack.pop(); + if (last && this.options.strictErrors !== true) { + var open = last.nodes[0]; + var inner = last.nodes[1]; + if (last.type === 'bracket') { + if (inner.val.charAt(0) === '[') { + inner.val = '\\' + inner.val; + } + + } else { + open.val = '\\' + open.val; + var sibling = open.parent.nodes[1]; + if (sibling.type === 'star') { + sibling.loose = true; + } + } + } + + // add non-enumerable parser reference + utils.define(parsed, 'parser', this.parser); + return parsed; + }); + + return snapdragon; +}; + +/** + * 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. + */ + +utils.createKey = function(pattern, options) { + if (typeof options === 'undefined') { + return pattern; + } + var key = pattern; + for (var prop in options) { + if (options.hasOwnProperty(prop)) { + key += ';' + prop + '=' + String(options[prop]); + } + } + return key; +}; + +/** + * Cast `val` to an array + * @return {Array} + */ + +utils.arrayify = function(val) { + if (typeof val === 'string') return [val]; + return val ? (Array.isArray(val) ? val : [val]) : []; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isString = function(val) { + return typeof val === 'string'; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isRegex = function(val) { + return utils.typeOf(val) === 'regexp'; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isObject = function(val) { + return utils.typeOf(val) === 'object'; +}; + +/** + * Escape regex characters in the given string + */ + +utils.escapeRegex = function(str) { + return str.replace(/[-[\]{}()^$|*+?.\\/\s]/g, '\\$&'); +}; + +/** + * Combines duplicate characters in the provided `input` string. + * @param {String} `input` + * @returns {String} + */ + +utils.combineDupes = function(input, patterns) { + patterns = utils.arrayify(patterns).join('|').split('|'); + patterns = patterns.map(function(s) { + return s.replace(/\\?([+*\\/])/g, '\\$1'); + }); + var substr = patterns.join('|'); + var regex = new RegExp('(' + substr + ')(?=\\1)', 'g'); + return input.replace(regex, ''); +}; + +/** + * Returns true if the given `str` has special characters + */ + +utils.hasSpecialChars = function(str) { + return /(?:(?:(^|\/)[!.])|[*?+()|[\]{}]|[+@]\()/.test(str); +}; + +/** + * Normalize slashes in the given filepath. + * + * @param {String} `filepath` + * @return {String} + */ + +utils.toPosixPath = function(str) { + return str.replace(/\\+/g, '/'); +}; + +/** + * Strip backslashes before special characters in a string. + * + * @param {String} `str` + * @return {String} + */ + +utils.unescape = function(str) { + return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, '')); +}; + +/** + * Strip the drive letter from a windows filepath + * @param {String} `fp` + * @return {String} + */ + +utils.stripDrive = function(fp) { + return utils.isWindows() ? fp.replace(/^[a-z]:[\\/]+?/i, '/') : fp; +}; + +/** + * Strip the prefix from a filepath + * @param {String} `fp` + * @return {String} + */ + +utils.stripPrefix = function(str) { + if (str.charAt(0) === '.' && (str.charAt(1) === '/' || str.charAt(1) === '\\')) { + return str.slice(2); + } + return str; +}; + +/** + * Returns true if `str` is a common character that doesn't need + * to be processed to be used for matching. + * @param {String} `str` + * @return {Boolean} + */ + +utils.isSimpleChar = function(str) { + return str.trim() === '' || str === '.'; +}; + +/** + * Returns true if the given str is an escaped or + * unescaped path character + */ + +utils.isSlash = function(str) { + return str === '/' || str === '\\/' || str === '\\' || str === '\\\\'; +}; + +/** + * Returns a function that returns true if the given + * pattern matches or contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.matchPath = function(pattern, options) { + return (options && options.contains) + ? utils.containsPattern(pattern, options) + : utils.equalsPattern(pattern, options); +}; + +/** + * Returns true if the given (original) filepath or unixified path are equal + * to the given pattern. + */ + +utils._equals = function(filepath, unixPath, pattern) { + return pattern === filepath || pattern === unixPath; +}; + +/** + * Returns true if the given (original) filepath or unixified path contain + * the given pattern. + */ + +utils._contains = function(filepath, unixPath, pattern) { + return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1; +}; + +/** + * Returns a function that returns true if the given + * pattern is the same as a given `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.equalsPattern = function(pattern, options) { + var unixify = utils.unixify(options); + options = options || {}; + + return function fn(filepath) { + var equal = utils._equals(filepath, unixify(filepath), pattern); + if (equal === true || options.nocase !== true) { + return equal; + } + var lower = filepath.toLowerCase(); + return utils._equals(lower, unixify(lower), pattern); + }; +}; + +/** + * Returns a function that returns true if the given + * pattern contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.containsPattern = function(pattern, options) { + var unixify = utils.unixify(options); + options = options || {}; + + return function(filepath) { + var contains = utils._contains(filepath, unixify(filepath), pattern); + if (contains === true || options.nocase !== true) { + return contains; + } + var lower = filepath.toLowerCase(); + return utils._contains(lower, unixify(lower), pattern); + }; +}; + +/** + * Returns a function that returns true if the given + * regex matches the `filename` of a file path. + * + * @param {RegExp} `re` Matching regex + * @return {Function} + */ + +utils.matchBasename = function(re) { + return function(filepath) { + return re.test(filepath) || re.test(path.basename(filepath)); + }; +}; + +/** + * Returns the given value unchanced. + * @return {any} + */ + +utils.identity = function(val) { + return val; +}; + +/** + * Determines the filepath to return based on the provided options. + * @return {any} + */ + +utils.value = function(str, unixify, options) { + if (options && options.unixify === false) { + return str; + } + if (options && typeof options.unixify === 'function') { + return options.unixify(str); + } + return unixify(str); +}; + +/** + * Returns a function that normalizes slashes in a string to forward + * slashes, strips `./` from beginning of paths, and optionally unescapes + * special characters. + * @return {Function} + */ + +utils.unixify = function(options) { + var opts = options || {}; + return function(filepath) { + if (opts.stripPrefix !== false) { + filepath = utils.stripPrefix(filepath); + } + if (opts.unescape === true) { + filepath = utils.unescape(filepath); + } + if (opts.unixify === true || utils.isWindows()) { + filepath = utils.toPosixPath(filepath); + } + return filepath; + }; +}; diff --git a/node_modules/nanomatch/node_modules/arr-diff/LICENSE b/node_modules/nanomatch/node_modules/arr-diff/LICENSE new file mode 100755 index 00000000..d734237b --- /dev/null +++ b/node_modules/nanomatch/node_modules/arr-diff/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/nanomatch/node_modules/arr-diff/README.md b/node_modules/nanomatch/node_modules/arr-diff/README.md new file mode 100644 index 00000000..961f5c3f --- /dev/null +++ b/node_modules/nanomatch/node_modules/arr-diff/README.md @@ -0,0 +1,130 @@ +# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg?style=flat)](https://www.npmjs.com/package/arr-diff) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-diff.svg?style=flat)](https://npmjs.org/package/arr-diff) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-diff.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-diff) + +> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save arr-diff +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add arr-diff +``` + +Install with [bower](https://bower.io/) + +```sh +$ bower install arr-diff --save +``` + +## Usage + +Returns the difference between the first array and additional arrays. + +```js +var diff = require('arr-diff'); + +var a = ['a', 'b', 'c', 'd']; +var b = ['b', 'c']; + +console.log(diff(a, b)) +//=> ['a', 'd'] +``` + +## Benchmarks + +This library versus [array-differ](https://github.com/sindresorhus/array-differ), on April 14, 2017: + +``` +Benchmarking: (4 of 4) + · long-dupes + · long + · med + · short + +# benchmark/fixtures/long-dupes.js (100804 bytes) + arr-diff-3.0.0 x 822 ops/sec ±0.67% (86 runs sampled) + arr-diff-4.0.0 x 2,141 ops/sec ±0.42% (89 runs sampled) + array-differ x 708 ops/sec ±0.70% (89 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/long.js (94529 bytes) + arr-diff-3.0.0 x 882 ops/sec ±0.60% (87 runs sampled) + arr-diff-4.0.0 x 2,329 ops/sec ±0.97% (83 runs sampled) + array-differ x 769 ops/sec ±0.61% (90 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/med.js (708 bytes) + arr-diff-3.0.0 x 856,150 ops/sec ±0.42% (89 runs sampled) + arr-diff-4.0.0 x 4,665,249 ops/sec ±1.06% (89 runs sampled) + array-differ x 653,888 ops/sec ±1.02% (86 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/short.js (60 bytes) + arr-diff-3.0.0 x 3,078,467 ops/sec ±0.77% (93 runs sampled) + arr-diff-4.0.0 x 9,213,296 ops/sec ±0.65% (89 runs sampled) + array-differ x 1,337,051 ops/sec ±0.91% (92 runs sampled) + + fastest is arr-diff-4.0.0 +``` + +## About + +### Related projects + +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") +* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter "Array#filter for older browsers.") +* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://github.com/jonschlinkert/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection "Return an array with the unique values present in _all_ given arrays using strict equality for comparisons.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 33 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [paulmillr](https://github.com/paulmillr) | + +### 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 14, 2017._ \ No newline at end of file diff --git a/node_modules/nanomatch/node_modules/arr-diff/index.js b/node_modules/nanomatch/node_modules/arr-diff/index.js new file mode 100644 index 00000000..90f28077 --- /dev/null +++ b/node_modules/nanomatch/node_modules/arr-diff/index.js @@ -0,0 +1,47 @@ +/*! + * arr-diff + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function diff(arr/*, arrays*/) { + var len = arguments.length; + var idx = 0; + while (++idx < len) { + arr = diffArray(arr, arguments[idx]); + } + return arr; +}; + +function diffArray(one, two) { + if (!Array.isArray(two)) { + return one.slice(); + } + + var tlen = two.length + var olen = one.length; + var idx = -1; + var arr = []; + + while (++idx < olen) { + var ele = one[idx]; + + var hasEle = false; + for (var i = 0; i < tlen; i++) { + var val = two[i]; + + if (ele === val) { + hasEle = true; + break; + } + } + + if (hasEle === false) { + arr.push(ele); + } + } + return arr; +} diff --git a/node_modules/nanomatch/node_modules/arr-diff/package.json b/node_modules/nanomatch/node_modules/arr-diff/package.json new file mode 100644 index 00000000..a6877f2b --- /dev/null +++ b/node_modules/nanomatch/node_modules/arr-diff/package.json @@ -0,0 +1,108 @@ +{ + "_from": "arr-diff@^4.0.0", + "_id": "arr-diff@4.0.0", + "_inBundle": false, + "_integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "_location": "/nanomatch/arr-diff", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "arr-diff@^4.0.0", + "name": "arr-diff", + "escapedName": "arr-diff", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/nanomatch" + ], + "_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "_shasum": "d6461074febfec71e7e15235761a329a5dc7c520", + "_spec": "arr-diff@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/nanomatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/arr-diff/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Paul Miller", + "email": "paul+gh@paulmillr.com", + "url": "paulmillr.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "arr-flatten": "^1.0.1", + "array-differ": "^1.0.0", + "benchmarked": "^0.2.4", + "gulp-format-md": "^0.1.9", + "minimist": "^1.2.0", + "mocha": "^2.4.5" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/arr-diff", + "keywords": [ + "arr", + "array", + "array differ", + "array-differ", + "diff", + "differ", + "difference" + ], + "license": "MIT", + "main": "index.js", + "name": "arr-diff", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/arr-diff.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-flatten", + "array-filter", + "array-intersection" + ] + }, + "reflinks": [ + "array-differ", + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "4.0.0" +} diff --git a/node_modules/nanomatch/node_modules/array-unique/LICENSE b/node_modules/nanomatch/node_modules/array-unique/LICENSE new file mode 100755 index 00000000..842218cf --- /dev/null +++ b/node_modules/nanomatch/node_modules/array-unique/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/nanomatch/node_modules/array-unique/README.md b/node_modules/nanomatch/node_modules/array-unique/README.md new file mode 100755 index 00000000..41c8c904 --- /dev/null +++ b/node_modules/nanomatch/node_modules/array-unique/README.md @@ -0,0 +1,77 @@ +# array-unique [![NPM version](https://img.shields.io/npm/v/array-unique.svg?style=flat)](https://www.npmjs.com/package/array-unique) [![NPM downloads](https://img.shields.io/npm/dm/array-unique.svg?style=flat)](https://npmjs.org/package/array-unique) [![Build Status](https://img.shields.io/travis/jonschlinkert/array-unique.svg?style=flat)](https://travis-ci.org/jonschlinkert/array-unique) + +Remove duplicate values from an array. Fastest ES5 implementation. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save array-unique +``` + +## Usage + +```js +var unique = require('array-unique'); + +var arr = ['a', 'b', 'c', 'c']; +console.log(unique(arr)) //=> ['a', 'b', 'c'] +console.log(arr) //=> ['a', 'b', 'c'] + +/* The above modifies the input array. To prevent that at a slight performance cost: */ +var unique = require("array-unique").immutable; + +var arr = ['a', 'b', 'c', 'c']; +console.log(unique(arr)) //=> ['a', 'b', 'c'] +console.log(arr) //=> ['a', 'b', 'c', 'c'] +``` + +## About + +### Related projects + +* [arr-diff](https://www.npmjs.com/package/arr-diff): Returns an array with only the unique values from the first array, by excluding all… [more](https://github.com/jonschlinkert/arr-diff) | [homepage](https://github.com/jonschlinkert/arr-diff "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.") +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") +* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map "Faster, node.js focused alternative to JavaScript's native array map.") +* [arr-pluck](https://www.npmjs.com/package/arr-pluck): Retrieves the value of a specified property from all elements in the collection. | [homepage](https://github.com/jonschlinkert/arr-pluck "Retrieves the value of a specified property from all elements in the collection.") +* [arr-reduce](https://www.npmjs.com/package/arr-reduce): Fast array reduce that also loops over sparse elements. | [homepage](https://github.com/jonschlinkert/arr-reduce "Fast array reduce that also loops over sparse elements.") +* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.") + +### 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/array-unique/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.28, on July 31, 2016._ \ No newline at end of file diff --git a/node_modules/nanomatch/node_modules/array-unique/index.js b/node_modules/nanomatch/node_modules/array-unique/index.js new file mode 100644 index 00000000..7e481e07 --- /dev/null +++ b/node_modules/nanomatch/node_modules/array-unique/index.js @@ -0,0 +1,43 @@ +/*! + * array-unique + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +module.exports = function unique(arr) { + if (!Array.isArray(arr)) { + throw new TypeError('array-unique expects an array.'); + } + + var len = arr.length; + var i = -1; + + while (i++ < len) { + var j = i + 1; + + for (; j < arr.length; ++j) { + if (arr[i] === arr[j]) { + arr.splice(j--, 1); + } + } + } + return arr; +}; + +module.exports.immutable = function uniqueImmutable(arr) { + if (!Array.isArray(arr)) { + throw new TypeError('array-unique expects an array.'); + } + + var arrLen = arr.length; + var newArr = new Array(arrLen); + + for (var i = 0; i < arrLen; i++) { + newArr[i] = arr[i]; + } + + return module.exports(newArr); +}; diff --git a/node_modules/nanomatch/node_modules/array-unique/package.json b/node_modules/nanomatch/node_modules/array-unique/package.json new file mode 100644 index 00000000..0767b82c --- /dev/null +++ b/node_modules/nanomatch/node_modules/array-unique/package.json @@ -0,0 +1,93 @@ +{ + "_from": "array-unique@^0.3.2", + "_id": "array-unique@0.3.2", + "_inBundle": false, + "_integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "_location": "/nanomatch/array-unique", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "array-unique@^0.3.2", + "name": "array-unique", + "escapedName": "array-unique", + "rawSpec": "^0.3.2", + "saveSpec": null, + "fetchSpec": "^0.3.2" + }, + "_requiredBy": [ + "/nanomatch" + ], + "_resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "_shasum": "a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428", + "_spec": "array-unique@^0.3.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/nanomatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/array-unique/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Remove duplicate values from an array. Fastest ES5 implementation.", + "devDependencies": { + "array-uniq": "^1.0.2", + "benchmarked": "^0.1.3", + "gulp-format-md": "^0.1.9", + "mocha": "^2.5.3", + "should": "^10.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/jonschlinkert/array-unique", + "keywords": [ + "array", + "unique" + ], + "license": "MIT", + "main": "index.js", + "name": "array-unique", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/array-unique.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-diff", + "arr-union", + "arr-flatten", + "arr-reduce", + "arr-map", + "arr-pluck" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.3.2" +} diff --git a/node_modules/nanomatch/node_modules/kind-of/CHANGELOG.md b/node_modules/nanomatch/node_modules/kind-of/CHANGELOG.md new file mode 100644 index 00000000..01687d5c --- /dev/null +++ b/node_modules/nanomatch/node_modules/kind-of/CHANGELOG.md @@ -0,0 +1,160 @@ +# 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.3] - 2020-01-16 + +- Merge pull request #31 for issue #30 + +## [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 \ No newline at end of file diff --git a/node_modules/nanomatch/node_modules/kind-of/LICENSE b/node_modules/nanomatch/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/nanomatch/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/nanomatch/node_modules/kind-of/README.md b/node_modules/nanomatch/node_modules/kind-of/README.md new file mode 100644 index 00000000..0411dc58 --- /dev/null +++ b/node_modules/nanomatch/node_modules/kind-of/README.md @@ -0,0 +1,367 @@ +# 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/micromatch/is-glob) | [homepage](https://github.com/micromatch/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 a number or string value is a finite number. Useful for regex… [more](https://github.com/jonschlinkert/is-number) | [homepage](https://github.com/jonschlinkert/is-number "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.") +* [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** | +| --- | --- | +| 102 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [doowb](https://github.com/doowb) | +| 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 | [tunnckoCore](https://github.com/tunnckoCore) | +| 1 | [xiaofen9](https://github.com/xiaofen9) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2020, [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.8.0, on January 16, 2020._ \ No newline at end of file diff --git a/node_modules/nanomatch/node_modules/kind-of/index.js b/node_modules/nanomatch/node_modules/kind-of/index.js new file mode 100644 index 00000000..dfa799b7 --- /dev/null +++ b/node_modules/nanomatch/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 typeof val.constructor === 'function' ? 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/nanomatch/node_modules/kind-of/package.json b/node_modules/nanomatch/node_modules/kind-of/package.json new file mode 100644 index 00000000..b352545f --- /dev/null +++ b/node_modules/nanomatch/node_modules/kind-of/package.json @@ -0,0 +1,143 @@ +{ + "_from": "kind-of@^6.0.2", + "_id": "kind-of@6.0.3", + "_inBundle": false, + "_integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "_location": "/nanomatch/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": [ + "/nanomatch" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "_shasum": "07c05034a6c349fa06e24fa35aa76db4580ce4dd", + "_spec": "kind-of@^6.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/nanomatch", + "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.3" +} diff --git a/node_modules/nanomatch/package.json b/node_modules/nanomatch/package.json new file mode 100644 index 00000000..6e9fd868 --- /dev/null +++ b/node_modules/nanomatch/package.json @@ -0,0 +1,171 @@ +{ + "_from": "nanomatch@^1.2.9", + "_id": "nanomatch@1.2.13", + "_inBundle": false, + "_integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "_location": "/nanomatch", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "nanomatch@^1.2.9", + "name": "nanomatch", + "escapedName": "nanomatch", + "rawSpec": "^1.2.9", + "saveSpec": null, + "fetchSpec": "^1.2.9" + }, + "_requiredBy": [ + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "_shasum": "b87a8aa4fc0de8fe6be88895b38983ff265bd119", + "_spec": "nanomatch@^1.2.9", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/micromatch/nanomatch/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Devon Govett", + "url": "http://badassjs.com" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "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-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "deprecated": false, + "description": "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)", + "devDependencies": { + "bash-match": "^1.0.2", + "for-own": "^1.0.0", + "gulp": "^3.9.1", + "gulp-format-md": "^1.0.0", + "gulp-istanbul": "^1.1.3", + "gulp-mocha": "^5.0.0", + "helper-changelog": "^0.3.0", + "minimatch": "^3.0.4", + "minimist": "^1.2.0", + "mocha": "^3.5.3", + "multimatch": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/micromatch/nanomatch", + "keywords": [ + "bash", + "expand", + "expansion", + "expression", + "file", + "files", + "filter", + "find", + "glob", + "globbing", + "globs", + "globstar", + "match", + "matcher", + "matches", + "matching", + "micromatch", + "minimatch", + "multimatch", + "nanomatch", + "path", + "pattern", + "patterns", + "regex", + "regexp", + "regular", + "shell", + "wildcard" + ], + "license": "MIT", + "lintDeps": { + "dependencies": { + "options": { + "lock": { + "snapdragon": "^0.8.1" + } + } + }, + "devDependencies": { + "files": { + "options": { + "ignore": [ + "benchmark/**" + ] + } + } + } + }, + "main": "index.js", + "name": "nanomatch", + "repository": { + "type": "git", + "url": "git+https://github.com/micromatch/nanomatch.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": "collapsible", + "layout": "default", + "tasks": [ + "readme" + ], + "helpers": [ + "helper-changelog" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "extglob", + "is-extglob", + "is-glob", + "micromatch" + ] + }, + "reflinks": [ + "expand-brackets", + "expand-tilde", + "glob-object", + "micromatch", + "minimatch", + "options", + "snapdragon" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.2.13" +} diff --git a/node_modules/normalize-path/LICENSE b/node_modules/normalize-path/LICENSE new file mode 100644 index 00000000..d734237b --- /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 00000000..daa0edda --- /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 00000000..4a4f8ccd --- /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 00000000..338808c4 --- /dev/null +++ b/node_modules/normalize-path/package.json @@ -0,0 +1,118 @@ +{ + "_from": "normalize-path@^2.0.0", + "_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.0.0", + "name": "normalize-path", + "escapedName": "normalize-path", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/anymatch", + "/micromatch" + ], + "_resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "_shasum": "1ab28b556e198363a8c1a6f7e6fa20137fe6aed9", + "_spec": "normalize-path@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/anymatch", + "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-prefix/LICENSE b/node_modules/npm-prefix/LICENSE new file mode 100644 index 00000000..389482d7 --- /dev/null +++ b/node_modules/npm-prefix/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, 2016 Eugene Sharygin + +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-prefix/README.md b/node_modules/npm-prefix/README.md new file mode 100644 index 00000000..36f5a6cc --- /dev/null +++ b/node_modules/npm-prefix/README.md @@ -0,0 +1,37 @@ +[![npm](https://nodei.co/npm/npm-prefix.png)](https://npmjs.com/package/npm-prefix) + +# npm-prefix + +[![Build Status][travis-badge]][travis] [![Dependency Status][david-badge]][david] + +Get global npm prefix. Respects npmrc configs. + +[travis]: https://travis-ci.org/eush77/npm-prefix +[travis-badge]: https://travis-ci.org/eush77/npm-prefix.svg?branch=master +[david]: https://david-dm.org/eush77/npm-prefix +[david-badge]: https://david-dm.org/eush77/npm-prefix.png + +## Example + +```js +var npmPrefix = require('npm-prefix'); + +npmPrefix() +//=> '/usr/local' +``` + +## API + +#### `npmPrefix()` + +Returns the npm prefix. + +## Install + +``` +npm install npm-prefix +``` + +## License + +MIT diff --git a/node_modules/npm-prefix/index.js b/node_modules/npm-prefix/index.js new file mode 100644 index 00000000..344f4c6f --- /dev/null +++ b/node_modules/npm-prefix/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var rc = require('rc'), + untildify = require('untildify'), + substitute = require('shellsubstitute'); + +var path = require('path'); + + +module.exports = function () { + var rcPrefix = rc('npm', null, []).prefix; + + if (rcPrefix) { + return untildify(substitute(rcPrefix, process.env)); + } + else if (process.platform == 'win32') { + return path.dirname(process.execPath); + } + else { + return path.resolve(process.execPath, '../..'); + } +}; diff --git a/node_modules/npm-prefix/package.json b/node_modules/npm-prefix/package.json new file mode 100644 index 00000000..8689c4bc --- /dev/null +++ b/node_modules/npm-prefix/package.json @@ -0,0 +1,73 @@ +{ + "_from": "npm-prefix@^1.2.0", + "_id": "npm-prefix@1.2.0", + "_inBundle": false, + "_integrity": "sha1-5hlFX3B0ulTMZtbQ033Z8b5ry8A=", + "_location": "/npm-prefix", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "npm-prefix@^1.2.0", + "name": "npm-prefix", + "escapedName": "npm-prefix", + "rawSpec": "^1.2.0", + "saveSpec": null, + "fetchSpec": "^1.2.0" + }, + "_requiredBy": [ + "/load-plugin" + ], + "_resolved": "https://registry.npmjs.org/npm-prefix/-/npm-prefix-1.2.0.tgz", + "_shasum": "e619455f7074ba54cc66d6d0d37dd9f1be6bcbc0", + "_spec": "npm-prefix@^1.2.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/load-plugin", + "author": { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + "bugs": { + "url": "https://github.com/eush77/npm-prefix/issues" + }, + "bundleDependencies": false, + "dependencies": { + "rc": "^1.1.0", + "shellsubstitute": "^1.1.0", + "untildify": "^2.1.0" + }, + "deprecated": false, + "description": "Get global npm prefix. Respects npmrc configs", + "devDependencies": { + "os-homedir": "^1.0.1", + "rewire": "^2.5.1", + "tape": "^4.2.2" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/eush77/npm-prefix", + "keywords": [ + "bin", + "config", + "global", + "lib", + "node_modules", + "npm", + "npmrc", + "path", + "prefix", + "require", + "resolve", + "root" + ], + "license": "MIT", + "name": "npm-prefix", + "repository": { + "type": "git", + "url": "git+https://github.com/eush77/npm-prefix.git" + }, + "scripts": { + "test": "tape test/*.js" + }, + "version": "1.2.0" +} diff --git a/node_modules/number-is-nan/index.js b/node_modules/number-is-nan/index.js new file mode 100644 index 00000000..79be4b9c --- /dev/null +++ b/node_modules/number-is-nan/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = Number.isNaN || function (x) { + return x !== x; +}; diff --git a/node_modules/number-is-nan/license b/node_modules/number-is-nan/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/number-is-nan/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/number-is-nan/package.json b/node_modules/number-is-nan/package.json new file mode 100644 index 00000000..ec094e6c --- /dev/null +++ b/node_modules/number-is-nan/package.json @@ -0,0 +1,67 @@ +{ + "_from": "number-is-nan@^1.0.0", + "_id": "number-is-nan@1.0.1", + "_inBundle": false, + "_integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "_location": "/number-is-nan", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "number-is-nan@^1.0.0", + "name": "number-is-nan", + "escapedName": "number-is-nan", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/is-fullwidth-code-point" + ], + "_resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "_shasum": "097b602b53422a522c1afb8790318336941a011d", + "_spec": "number-is-nan@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/is-fullwidth-code-point", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/number-is-nan/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "ES2015 Number.isNaN() ponyfill", + "devDependencies": { + "ava": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/number-is-nan#readme", + "keywords": [ + "es2015", + "ecmascript", + "ponyfill", + "polyfill", + "shim", + "number", + "is", + "nan", + "not" + ], + "license": "MIT", + "name": "number-is-nan", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/number-is-nan.git" + }, + "scripts": { + "test": "ava" + }, + "version": "1.0.1" +} diff --git a/node_modules/number-is-nan/readme.md b/node_modules/number-is-nan/readme.md new file mode 100644 index 00000000..24635087 --- /dev/null +++ b/node_modules/number-is-nan/readme.md @@ -0,0 +1,28 @@ +# number-is-nan [![Build Status](https://travis-ci.org/sindresorhus/number-is-nan.svg?branch=master)](https://travis-ci.org/sindresorhus/number-is-nan) + +> ES2015 [`Number.isNaN()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save number-is-nan +``` + + +## Usage + +```js +var numberIsNan = require('number-is-nan'); + +numberIsNan(NaN); +//=> true + +numberIsNan('unicorn'); +//=> false +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/object-copy/LICENSE b/node_modules/object-copy/LICENSE new file mode 100644 index 00000000..e28e6032 --- /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 00000000..f9faa223 --- /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 00000000..65f90aca --- /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 00000000..8cac698a --- /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 00000000..3e0e5e13 --- /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 00000000..7d38c4b5 --- /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": "/home/remi/github/CPP_BIDS/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/package.json b/node_modules/object-copy/package.json new file mode 100644 index 00000000..b671c1cb --- /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": { + "is-descriptor": "0.1.6" + }, + "_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": "/home/remi/github/CPP_BIDS/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 00000000..ec85897e --- /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 00000000..64015cb9 --- /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 00000000..fcaeda92 --- /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/node_modules/isobject/LICENSE b/node_modules/object-visit/node_modules/isobject/LICENSE new file mode 100644 index 00000000..943e71d0 --- /dev/null +++ b/node_modules/object-visit/node_modules/isobject/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/object-visit/node_modules/isobject/README.md b/node_modules/object-visit/node_modules/isobject/README.md new file mode 100644 index 00000000..d01feaa4 --- /dev/null +++ b/node_modules/object-visit/node_modules/isobject/README.md @@ -0,0 +1,122 @@ +# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM monthly downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![NPM total downloads](https://img.shields.io/npm/dt/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat&label=Travis)](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 --save isobject +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add isobject +``` + +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](https://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); +``` + +## 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.") +* [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 "Returns true if an object was created by the `Object` constructor.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") +* [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.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 29 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [magnudae](https://github.com/magnudae) | +| 1 | [LeSuisse](https://github.com/LeSuisse) | +| 1 | [tmcw](https://github.com/tmcw) | + +### 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 30, 2017._ \ No newline at end of file diff --git a/node_modules/object-visit/node_modules/isobject/index.d.ts b/node_modules/object-visit/node_modules/isobject/index.d.ts new file mode 100644 index 00000000..55f81c27 --- /dev/null +++ b/node_modules/object-visit/node_modules/isobject/index.d.ts @@ -0,0 +1,5 @@ +export = isObject; + +declare function isObject(val: any): boolean; + +declare namespace isObject {} diff --git a/node_modules/object-visit/node_modules/isobject/index.js b/node_modules/object-visit/node_modules/isobject/index.js new file mode 100644 index 00000000..2d59958b --- /dev/null +++ b/node_modules/object-visit/node_modules/isobject/index.js @@ -0,0 +1,12 @@ +/*! + * isobject + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function isObject(val) { + return val != null && typeof val === 'object' && Array.isArray(val) === false; +}; diff --git a/node_modules/object-visit/node_modules/isobject/package.json b/node_modules/object-visit/node_modules/isobject/package.json new file mode 100644 index 00000000..1e801baf --- /dev/null +++ b/node_modules/object-visit/node_modules/isobject/package.json @@ -0,0 +1,119 @@ +{ + "_from": "isobject@^3.0.0", + "_id": "isobject@3.0.1", + "_inBundle": false, + "_integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "_location": "/object-visit/isobject", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "isobject@^3.0.0", + "name": "isobject", + "escapedName": "isobject", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/object-visit" + ], + "_resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "_shasum": "4e431e92b11a9731636aa1f9c8d1ccbcfdab78df", + "_spec": "isobject@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/object-visit", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/isobject/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "url": "https://github.com/LeSuisse" + }, + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Magnús Dæhlen", + "url": "https://github.com/magnudae" + }, + { + "name": "Tom MacWright", + "url": "https://macwright.org" + } + ], + "dependencies": {}, + "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.d.ts", + "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" + }, + "types": "index.d.ts", + "verb": { + "related": { + "list": [ + "extend-shallow", + "is-plain-object", + "kind-of", + "merge-deep" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "3.0.1" +} diff --git a/node_modules/object-visit/package.json b/node_modules/object-visit/package.json new file mode 100644 index 00000000..975d60c0 --- /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": "/home/remi/github/CPP_BIDS/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.omit/LICENSE b/node_modules/object.omit/LICENSE new file mode 100644 index 00000000..842218cf --- /dev/null +++ b/node_modules/object.omit/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.omit/README.md b/node_modules/object.omit/README.md new file mode 100644 index 00000000..246efe09 --- /dev/null +++ b/node_modules/object.omit/README.md @@ -0,0 +1,118 @@ +# object.omit [![NPM version](https://img.shields.io/npm/v/object.omit.svg?style=flat)](https://www.npmjs.com/package/object.omit) [![NPM monthly downloads](https://img.shields.io/npm/dm/object.omit.svg?style=flat)](https://npmjs.org/package/object.omit) [![NPM total downloads](https://img.shields.io/npm/dt/object.omit.svg?style=flat)](https://npmjs.org/package/object.omit) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/object.omit.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/object.omit) + +> Return a copy of an object excluding the given key, or array of keys. Also accepts an optional filter function as the last argument. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save object.omit +``` + +## Usage + +```js +var omit = require('object.omit'); +``` + +Pass a string `key` to omit: + +```js +omit({a: 'a', b: 'b', c: 'c'}, 'a') +//=> { b: 'b', c: 'c' } +``` + +Pass an array of `keys` to omit: + +```js +omit({a: 'a', b: 'b', c: 'c'}, ['a', 'c']) +//=> { b: 'b' } +``` + +Returns the object if no keys are passed: + +```js +omit({a: 'a', b: 'b', c: 'c'}) +//=> {a: 'a', b: 'b', c: 'c'} +``` + +Returns an empty object if no value is passed. + +```js +omit() +//=> {} +``` + +### Filter function + +An optional filter function may be passed as the last argument, with or without keys passed on the arguments: + +**filter on keys** + +```js +var res = omit({a: 'a', b: 'b', c: 'c'}, function (val, key) { + return key === 'a'; +}); +//=> {a: 'a'} +``` + +**filter on values** + +```js +var fn = function() {}; +var obj = {a: 'a', b: 'b', c: fn}; + +var res = omit(obj, ['a'], function (val, key) { + return typeof val !== 'function'; +}); +//=> {b: 'b'} +``` + +## About + +### Related projects + +* [object.defaults](https://www.npmjs.com/package/object.defaults): Like `extend` but only copies missing properties/values to the target object. | [homepage](https://github.com/jonschlinkert/object.defaults "Like `extend` but only copies missing properties/values to the target object.") +* [object.filter](https://www.npmjs.com/package/object.filter): Create a new object filtered to have only properties for which the callback returns true. | [homepage](https://github.com/jonschlinkert/object.filter "Create a new object filtered to have only properties for which the callback returns true.") +* [object.pick](https://www.npmjs.com/package/object.pick): Returns a filtered copy of an object with only the specified keys, similar to `_.pick… [more](https://github.com/jonschlinkert/object.pick) | [homepage](https://github.com/jonschlinkert/object.pick "Returns a filtered copy of an object with only the specified keys, similar to`_.pick` from lodash / underscore.") +* [object.pluck](https://www.npmjs.com/package/object.pluck): Like pluck from underscore / lo-dash, but returns an object composed of specified properties, with… [more](https://github.com/jonschlinkert/object.pluck) | [homepage](https://github.com/jonschlinkert/object.pluck "Like pluck from underscore / lo-dash, but returns an object composed of specified properties, with values unmodified from those of the original object.") +* [object.reduce](https://www.npmjs.com/package/object.reduce): Reduces an object to a value that is the accumulated result of running each property… [more](https://github.com/jonschlinkert/object.reduce) | [homepage](https://github.com/jonschlinkert/object.reduce "Reduces an object to a value that is the accumulated result of running each property in the object through a callback.") + +### 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.omit/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.omit/index.js b/node_modules/object.omit/index.js new file mode 100644 index 00000000..503a3c30 --- /dev/null +++ b/node_modules/object.omit/index.js @@ -0,0 +1,40 @@ +/*! + * object.omit + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isObject = require('is-extendable'); +var forOwn = require('for-own'); + +module.exports = function omit(obj, keys) { + if (!isObject(obj)) return {}; + + keys = [].concat.apply([], [].slice.call(arguments, 1)); + var last = keys[keys.length - 1]; + var res = {}, fn; + + if (typeof last === 'function') { + fn = keys.pop(); + } + + var isFunction = typeof fn === 'function'; + if (!keys.length && !isFunction) { + return obj; + } + + forOwn(obj, function(value, key) { + if (keys.indexOf(key) === -1) { + + if (!isFunction) { + res[key] = value; + } else if (fn(value, key, obj)) { + res[key] = value; + } + } + }); + return res; +}; diff --git a/node_modules/object.omit/package.json b/node_modules/object.omit/package.json new file mode 100644 index 00000000..22c95ba6 --- /dev/null +++ b/node_modules/object.omit/package.json @@ -0,0 +1,98 @@ +{ + "_from": "object.omit@^2.0.0", + "_id": "object.omit@2.0.1", + "_inBundle": false, + "_integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "_location": "/object.omit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "object.omit@^2.0.0", + "name": "object.omit", + "escapedName": "object.omit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/micromatch" + ], + "_resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "_shasum": "1a9c744829f39dbb858c76ca3579ae2a54ebd1fa", + "_spec": "object.omit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/object.omit/issues" + }, + "bundleDependencies": false, + "dependencies": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + }, + "deprecated": false, + "description": "Return a copy of an object excluding the given key, or array of keys. Also accepts an optional filter function as the last argument.", + "devDependencies": { + "gulp-format-md": "^0.1.11", + "mocha": "^3.1.2", + "should": "^11.1.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/object.omit", + "keywords": [ + "clear", + "delete", + "key", + "object", + "omit", + "property", + "remove", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "object.omit", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/object.omit.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "object.defaults", + "object.filter", + "object.pick", + "object.pluck", + "object.reduce" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ] + }, + "version": "2.0.1" +} diff --git a/node_modules/object.pick/LICENSE b/node_modules/object.pick/LICENSE new file mode 100644 index 00000000..39245ac1 --- /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 00000000..48f74534 --- /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 00000000..0ce01782 --- /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/node_modules/isobject/LICENSE b/node_modules/object.pick/node_modules/isobject/LICENSE new file mode 100644 index 00000000..943e71d0 --- /dev/null +++ b/node_modules/object.pick/node_modules/isobject/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/object.pick/node_modules/isobject/README.md b/node_modules/object.pick/node_modules/isobject/README.md new file mode 100644 index 00000000..d01feaa4 --- /dev/null +++ b/node_modules/object.pick/node_modules/isobject/README.md @@ -0,0 +1,122 @@ +# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM monthly downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![NPM total downloads](https://img.shields.io/npm/dt/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat&label=Travis)](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 --save isobject +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add isobject +``` + +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](https://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); +``` + +## 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.") +* [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 "Returns true if an object was created by the `Object` constructor.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") +* [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.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 29 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [magnudae](https://github.com/magnudae) | +| 1 | [LeSuisse](https://github.com/LeSuisse) | +| 1 | [tmcw](https://github.com/tmcw) | + +### 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 30, 2017._ \ No newline at end of file diff --git a/node_modules/object.pick/node_modules/isobject/index.d.ts b/node_modules/object.pick/node_modules/isobject/index.d.ts new file mode 100644 index 00000000..55f81c27 --- /dev/null +++ b/node_modules/object.pick/node_modules/isobject/index.d.ts @@ -0,0 +1,5 @@ +export = isObject; + +declare function isObject(val: any): boolean; + +declare namespace isObject {} diff --git a/node_modules/object.pick/node_modules/isobject/index.js b/node_modules/object.pick/node_modules/isobject/index.js new file mode 100644 index 00000000..2d59958b --- /dev/null +++ b/node_modules/object.pick/node_modules/isobject/index.js @@ -0,0 +1,12 @@ +/*! + * isobject + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function isObject(val) { + return val != null && typeof val === 'object' && Array.isArray(val) === false; +}; diff --git a/node_modules/object.pick/node_modules/isobject/package.json b/node_modules/object.pick/node_modules/isobject/package.json new file mode 100644 index 00000000..3764e7bc --- /dev/null +++ b/node_modules/object.pick/node_modules/isobject/package.json @@ -0,0 +1,119 @@ +{ + "_from": "isobject@^3.0.1", + "_id": "isobject@3.0.1", + "_inBundle": false, + "_integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "_location": "/object.pick/isobject", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "isobject@^3.0.1", + "name": "isobject", + "escapedName": "isobject", + "rawSpec": "^3.0.1", + "saveSpec": null, + "fetchSpec": "^3.0.1" + }, + "_requiredBy": [ + "/object.pick" + ], + "_resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "_shasum": "4e431e92b11a9731636aa1f9c8d1ccbcfdab78df", + "_spec": "isobject@^3.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/object.pick", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/isobject/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "url": "https://github.com/LeSuisse" + }, + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Magnús Dæhlen", + "url": "https://github.com/magnudae" + }, + { + "name": "Tom MacWright", + "url": "https://macwright.org" + } + ], + "dependencies": {}, + "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.d.ts", + "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" + }, + "types": "index.d.ts", + "verb": { + "related": { + "list": [ + "extend-shallow", + "is-plain-object", + "kind-of", + "merge-deep" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "3.0.1" +} diff --git a/node_modules/object.pick/package.json b/node_modules/object.pick/package.json new file mode 100644 index 00000000..9c9f9cd4 --- /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": [ + "/nanomatch", + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "_shasum": "87a10ac4c1694bd2e1cbf53591a66141fb5dd747", + "_spec": "object.pick@^1.3.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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/once/LICENSE b/node_modules/once/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/once/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/once/README.md b/node_modules/once/README.md new file mode 100644 index 00000000..1f1ffca9 --- /dev/null +++ b/node_modules/once/README.md @@ -0,0 +1,79 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` + +## `once.strict(func)` + +Throw an error if the function is called twice. + +Some functions are expected to be called only once. Using `once` for them would +potentially hide logical errors. + +In the example below, the `greet` function has to call the callback only once: + +```javascript +function greet (name, cb) { + // return is missing from the if statement + // when no name is passed, the callback is called twice + if (!name) cb('Hello anonymous') + cb('Hello ' + name) +} + +function log (msg) { + console.log(msg) +} + +// this will print 'Hello anonymous' but the logical error will be missed +greet(null, once(msg)) + +// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time +greet(null, once.strict(msg)) +``` diff --git a/node_modules/once/once.js b/node_modules/once/once.js new file mode 100644 index 00000000..23540673 --- /dev/null +++ b/node_modules/once/once.js @@ -0,0 +1,42 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} diff --git a/node_modules/once/package.json b/node_modules/once/package.json new file mode 100644 index 00000000..37b12646 --- /dev/null +++ b/node_modules/once/package.json @@ -0,0 +1,67 @@ +{ + "_from": "once@^1.3.0", + "_id": "once@1.4.0", + "_inBundle": false, + "_integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "_location": "/once", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "once@^1.3.0", + "name": "once", + "escapedName": "once", + "rawSpec": "^1.3.0", + "saveSpec": null, + "fetchSpec": "^1.3.0" + }, + "_requiredBy": [ + "/glob", + "/inflight" + ], + "_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1", + "_spec": "once@^1.3.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/glob", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/once/issues" + }, + "bundleDependencies": false, + "dependencies": { + "wrappy": "1" + }, + "deprecated": false, + "description": "Run a function exactly one time", + "devDependencies": { + "tap": "^7.0.1" + }, + "directories": { + "test": "test" + }, + "files": [ + "once.js" + ], + "homepage": "https://github.com/isaacs/once#readme", + "keywords": [ + "once", + "function", + "one", + "single" + ], + "license": "ISC", + "main": "once.js", + "name": "once", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "1.4.0" +} diff --git a/node_modules/os-homedir/index.js b/node_modules/os-homedir/index.js new file mode 100644 index 00000000..33066166 --- /dev/null +++ b/node_modules/os-homedir/index.js @@ -0,0 +1,24 @@ +'use strict'; +var os = require('os'); + +function homedir() { + var env = process.env; + var home = env.HOME; + var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; + + if (process.platform === 'win32') { + return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null; + } + + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } + + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); + } + + return home || null; +} + +module.exports = typeof os.homedir === 'function' ? os.homedir : homedir; diff --git a/node_modules/os-homedir/license b/node_modules/os-homedir/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/os-homedir/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/os-homedir/package.json b/node_modules/os-homedir/package.json new file mode 100644 index 00000000..10a75e8d --- /dev/null +++ b/node_modules/os-homedir/package.json @@ -0,0 +1,73 @@ +{ + "_from": "os-homedir@^1.0.0", + "_id": "os-homedir@1.0.2", + "_inBundle": false, + "_integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "_location": "/os-homedir", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "os-homedir@^1.0.0", + "name": "os-homedir", + "escapedName": "os-homedir", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/untildify" + ], + "_resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "_shasum": "ffbc4988336e0e833de0c168c7ef152121aa7fb3", + "_spec": "os-homedir@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/untildify", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/os-homedir/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Node.js 4 `os.homedir()` ponyfill", + "devDependencies": { + "ava": "*", + "path-exists": "^2.0.0", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/os-homedir#readme", + "keywords": [ + "builtin", + "core", + "ponyfill", + "polyfill", + "shim", + "os", + "homedir", + "home", + "dir", + "directory", + "folder", + "user", + "path" + ], + "license": "MIT", + "name": "os-homedir", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/os-homedir.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.2" +} diff --git a/node_modules/os-homedir/readme.md b/node_modules/os-homedir/readme.md new file mode 100644 index 00000000..856ae615 --- /dev/null +++ b/node_modules/os-homedir/readme.md @@ -0,0 +1,31 @@ +# os-homedir [![Build Status](https://travis-ci.org/sindresorhus/os-homedir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-homedir) + +> Node.js 4 [`os.homedir()`](https://nodejs.org/api/os.html#os_os_homedir) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save os-homedir +``` + + +## Usage + +```js +const osHomedir = require('os-homedir'); + +console.log(osHomedir()); +//=> '/Users/sindresorhus' +``` + + +## Related + +- [user-home](https://github.com/sindresorhus/user-home) - Same as this module but caches the result +- [home-or-tmp](https://github.com/sindresorhus/home-or-tmp) - Get the user home directory with fallback to the system temp directory + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/parse-entities/decode-entity.browser.js b/node_modules/parse-entities/decode-entity.browser.js new file mode 100644 index 00000000..feb32664 --- /dev/null +++ b/node_modules/parse-entities/decode-entity.browser.js @@ -0,0 +1,30 @@ +'use strict' + +/* eslint-env browser */ + +var el + +var semicolon = 59 // ';' + +module.exports = decodeEntity + +function decodeEntity(characters) { + var entity = '&' + characters + ';' + var char + + el = el || document.createElement('i') + el.innerHTML = entity + char = el.textContent + + // Some entities do not require the closing semicolon (`¬` - for instance), + // which leads to situations where parsing the assumed entity of ¬it; will + // result in the string `¬it;`. When we encounter a trailing semicolon after + // parsing and the entity to decode was not a semicolon (`;`), we can + // assume that the matching was incomplete + if (char.charCodeAt(char.length - 1) === semicolon && characters !== 'semi') { + return false + } + + // If the decoded string is equal to the input, the entity was not valid + return char === entity ? false : char +} diff --git a/node_modules/parse-entities/decode-entity.js b/node_modules/parse-entities/decode-entity.js new file mode 100644 index 00000000..87c3b1e0 --- /dev/null +++ b/node_modules/parse-entities/decode-entity.js @@ -0,0 +1,13 @@ +'use strict' + +var characterEntities = require('character-entities') + +module.exports = decodeEntity + +var own = {}.hasOwnProperty + +function decodeEntity(characters) { + return own.call(characterEntities, characters) + ? characterEntities[characters] + : false +} diff --git a/node_modules/parse-entities/index.js b/node_modules/parse-entities/index.js new file mode 100644 index 00000000..1606d02f --- /dev/null +++ b/node_modules/parse-entities/index.js @@ -0,0 +1,450 @@ +'use strict' + +var legacy = require('character-entities-legacy') +var invalid = require('character-reference-invalid') +var decimal = require('is-decimal') +var hexadecimal = require('is-hexadecimal') +var alphanumerical = require('is-alphanumerical') +var decodeEntity = require('./decode-entity') + +module.exports = parseEntities + +var own = {}.hasOwnProperty +var fromCharCode = String.fromCharCode +var noop = Function.prototype + +// Default settings. +var defaults = { + warning: null, + reference: null, + text: null, + warningContext: null, + referenceContext: null, + textContext: null, + position: {}, + additional: null, + attribute: false, + nonTerminated: true +} + +// Characters. +var tab = 9 // '\t' +var lineFeed = 10 // '\n' +var formFeed = 12 // '\f' +var space = 32 // ' ' +var ampersand = 38 // '&' +var semicolon = 59 // ';' +var lessThan = 60 // '<' +var equalsTo = 61 // '=' +var numberSign = 35 // '#' +var uppercaseX = 88 // 'X' +var lowercaseX = 120 // 'x' +var replacementCharacter = 65533 // '�' + +// Reference types. +var name = 'named' +var hexa = 'hexadecimal' +var deci = 'decimal' + +// Map of bases. +var bases = {} + +bases[hexa] = 16 +bases[deci] = 10 + +// Map of types to tests. +// Each type of character reference accepts different characters. +// This test is used to detect whether a reference has ended (as the semicolon +// is not strictly needed). +var tests = {} + +tests[name] = alphanumerical +tests[deci] = decimal +tests[hexa] = hexadecimal + +// Warning types. +var namedNotTerminated = 1 +var numericNotTerminated = 2 +var namedEmpty = 3 +var numericEmpty = 4 +var namedUnknown = 5 +var numericDisallowed = 6 +var numericProhibited = 7 + +// Warning messages. +var messages = {} + +messages[namedNotTerminated] = + 'Named character references must be terminated by a semicolon' +messages[numericNotTerminated] = + 'Numeric character references must be terminated by a semicolon' +messages[namedEmpty] = 'Named character references cannot be empty' +messages[numericEmpty] = 'Numeric character references cannot be empty' +messages[namedUnknown] = 'Named character references must be known' +messages[numericDisallowed] = + 'Numeric character references cannot be disallowed' +messages[numericProhibited] = + 'Numeric character references cannot be outside the permissible Unicode range' + +// Wrap to ensure clean parameters are given to `parse`. +function parseEntities(value, options) { + var settings = {} + var option + var key + + if (!options) { + options = {} + } + + for (key in defaults) { + option = options[key] + settings[key] = + option === null || option === undefined ? defaults[key] : option + } + + if (settings.position.indent || settings.position.start) { + settings.indent = settings.position.indent || [] + settings.position = settings.position.start + } + + return parse(value, settings) +} + +// Parse entities. +// eslint-disable-next-line complexity +function parse(value, settings) { + var additional = settings.additional + var nonTerminated = settings.nonTerminated + var handleText = settings.text + var handleReference = settings.reference + var handleWarning = settings.warning + var textContext = settings.textContext + var referenceContext = settings.referenceContext + var warningContext = settings.warningContext + var pos = settings.position + var indent = settings.indent || [] + var length = value.length + var index = 0 + var lines = -1 + var column = pos.column || 1 + var line = pos.line || 1 + var queue = '' + var result = [] + var entityCharacters + var namedEntity + var terminated + var characters + var character + var reference + var following + var warning + var reason + var output + var entity + var begin + var start + var type + var test + var prev + var next + var diff + var end + + if (typeof additional === 'string') { + additional = additional.charCodeAt(0) + } + + // Cache the current point. + prev = now() + + // Wrap `handleWarning`. + warning = handleWarning ? parseError : noop + + // Ensure the algorithm walks over the first character and the end (inclusive). + index-- + length++ + + while (++index < length) { + // If the previous character was a newline. + if (character === lineFeed) { + column = indent[lines] || 1 + } + + character = value.charCodeAt(index) + + if (character === ampersand) { + following = value.charCodeAt(index + 1) + + // The behaviour depends on the identity of the next character. + if ( + following === tab || + following === lineFeed || + following === formFeed || + following === space || + following === ampersand || + following === lessThan || + following !== following || + (additional && following === additional) + ) { + // Not a character reference. + // No characters are consumed, and nothing is returned. + // This is not an error, either. + queue += fromCharCode(character) + column++ + + continue + } + + start = index + 1 + begin = start + end = start + + if (following === numberSign) { + // Numerical entity. + end = ++begin + + // The behaviour further depends on the next character. + following = value.charCodeAt(end) + + if (following === uppercaseX || following === lowercaseX) { + // ASCII hex digits. + type = hexa + end = ++begin + } else { + // ASCII digits. + type = deci + } + } else { + // Named entity. + type = name + } + + entityCharacters = '' + entity = '' + characters = '' + test = tests[type] + end-- + + while (++end < length) { + following = value.charCodeAt(end) + + if (!test(following)) { + break + } + + characters += fromCharCode(following) + + // Check if we can match a legacy named reference. + // If so, we cache that as the last viable named reference. + // This ensures we do not need to walk backwards later. + if (type === name && own.call(legacy, characters)) { + entityCharacters = characters + entity = legacy[characters] + } + } + + terminated = value.charCodeAt(end) === semicolon + + if (terminated) { + end++ + + namedEntity = type === name ? decodeEntity(characters) : false + + if (namedEntity) { + entityCharacters = characters + entity = namedEntity + } + } + + diff = 1 + end - start + + if (!terminated && !nonTerminated) { + // Empty. + } else if (!characters) { + // An empty (possible) entity is valid, unless it’s numeric (thus an + // ampersand followed by an octothorp). + if (type !== name) { + warning(numericEmpty, diff) + } + } else if (type === name) { + // An ampersand followed by anything unknown, and not terminated, is + // invalid. + if (terminated && !entity) { + warning(namedUnknown, 1) + } else { + // If theres something after an entity name which is not known, cap + // the reference. + if (entityCharacters !== characters) { + end = begin + entityCharacters.length + diff = 1 + end - begin + terminated = false + } + + // If the reference is not terminated, warn. + if (!terminated) { + reason = entityCharacters ? namedNotTerminated : namedEmpty + + if (settings.attribute) { + following = value.charCodeAt(end) + + if (following === equalsTo) { + warning(reason, diff) + entity = null + } else if (alphanumerical(following)) { + entity = null + } else { + warning(reason, diff) + } + } else { + warning(reason, diff) + } + } + } + + reference = entity + } else { + if (!terminated) { + // All non-terminated numeric entities are not rendered, and trigger a + // warning. + warning(numericNotTerminated, diff) + } + + // When terminated and number, parse as either hexadecimal or decimal. + reference = parseInt(characters, bases[type]) + + // Trigger a warning when the parsed number is prohibited, and replace + // with replacement character. + if (prohibited(reference)) { + warning(numericProhibited, diff) + reference = fromCharCode(replacementCharacter) + } else if (reference in invalid) { + // Trigger a warning when the parsed number is disallowed, and replace + // by an alternative. + warning(numericDisallowed, diff) + reference = invalid[reference] + } else { + // Parse the number. + output = '' + + // Trigger a warning when the parsed number should not be used. + if (disallowed(reference)) { + warning(numericDisallowed, diff) + } + + // Stringify the number. + if (reference > 0xffff) { + reference -= 0x10000 + output += fromCharCode((reference >>> (10 & 0x3ff)) | 0xd800) + reference = 0xdc00 | (reference & 0x3ff) + } + + reference = output + fromCharCode(reference) + } + } + + // Found it! + // First eat the queued characters as normal text, then eat an entity. + if (reference) { + flush() + + prev = now() + index = end - 1 + column += end - start + 1 + result.push(reference) + next = now() + next.offset++ + + if (handleReference) { + handleReference.call( + referenceContext, + reference, + {start: prev, end: next}, + value.slice(start - 1, end) + ) + } + + prev = next + } else { + // If we could not find a reference, queue the checked characters (as + // normal characters), and move the pointer to their end. + // This is possible because we can be certain neither newlines nor + // ampersands are included. + characters = value.slice(start - 1, end) + queue += characters + column += characters.length + index = end - 1 + } + } else { + // Handle anything other than an ampersand, including newlines and EOF. + if ( + character === 10 // Line feed + ) { + line++ + lines++ + column = 0 + } + + if (character === character) { + queue += fromCharCode(character) + column++ + } else { + flush() + } + } + } + + // Return the reduced nodes, and any possible warnings. + return result.join('') + + // Get current position. + function now() { + return { + line: line, + column: column, + offset: index + (pos.offset || 0) + } + } + + // “Throw” a parse-error: a warning. + function parseError(code, offset) { + var position = now() + + position.column += offset + position.offset += offset + + handleWarning.call(warningContext, messages[code], position, code) + } + + // Flush `queue` (normal text). + // Macro invoked before each entity and at the end of `value`. + // Does nothing when `queue` is empty. + function flush() { + if (queue) { + result.push(queue) + + if (handleText) { + handleText.call(textContext, queue, {start: prev, end: now()}) + } + + queue = '' + } + } +} + +// Check if `character` is outside the permissible unicode range. +function prohibited(code) { + return (code >= 0xd800 && code <= 0xdfff) || code > 0x10ffff +} + +// Check if `character` is disallowed. +function disallowed(code) { + return ( + (code >= 0x0001 && code <= 0x0008) || + code === 0x000b || + (code >= 0x000d && code <= 0x001f) || + (code >= 0x007f && code <= 0x009f) || + (code >= 0xfdd0 && code <= 0xfdef) || + (code & 0xffff) === 0xffff || + (code & 0xffff) === 0xfffe + ) +} diff --git a/node_modules/parse-entities/license b/node_modules/parse-entities/license new file mode 100644 index 00000000..611b6758 --- /dev/null +++ b/node_modules/parse-entities/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/parse-entities/package.json b/node_modules/parse-entities/package.json new file mode 100644 index 00000000..ab8b4049 --- /dev/null +++ b/node_modules/parse-entities/package.json @@ -0,0 +1,131 @@ +{ + "_from": "parse-entities@^1.1.0", + "_id": "parse-entities@1.2.2", + "_inBundle": false, + "_integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==", + "_location": "/parse-entities", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "parse-entities@^1.1.0", + "name": "parse-entities", + "escapedName": "parse-entities", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/remark-parse", + "/remark-stringify" + ], + "_resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz", + "_shasum": "c31bf0f653b6661354f8973559cb86dd1d5edf50", + "_spec": "parse-entities@^1.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./decode-entity.js": "./decode-entity.browser.js" + }, + "bugs": { + "url": "https://github.com/wooorm/parse-entities/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "character-entities": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "character-reference-invalid": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-hexadecimal": "^1.0.0" + }, + "deprecated": false, + "description": "Parse HTML character references: fast, spec-compliant, positional information", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^14.0.0", + "prettier": "^1.12.1", + "remark-cli": "^6.0.0", + "remark-preset-wooorm": "^4.0.0", + "tape": "^4.2.0", + "tape-run": "^6.0.0", + "tinyify": "^2.4.3", + "xo": "^0.24.0" + }, + "files": [ + "index.js", + "decode-entity.js", + "decode-entity.browser.js" + ], + "homepage": "https://github.com/wooorm/parse-entities#readme", + "keywords": [ + "parse", + "html", + "character", + "reference", + "entity", + "entities" + ], + "license": "MIT", + "name": "parse-entities", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./decode-entity.js": "./decode-entity.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/parse-entities.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s parseEntities > parse-entities.js", + "build-mangle": "browserify . -s parseEntities -p tinyify > parse-entities.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-browser", + "test-api": "node test", + "test-browser": "browserify test.js | tape-run", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.2.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "no-self-compare": "off", + "guard-for-in": "off", + "max-depth": "off" + }, + "ignores": [ + "parse-entities.js" + ] + } +} diff --git a/node_modules/parse-entities/readme.md b/node_modules/parse-entities/readme.md new file mode 100644 index 00000000..e9cc0f03 --- /dev/null +++ b/node_modules/parse-entities/readme.md @@ -0,0 +1,217 @@ +# parse-entities + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Parse HTML character references: fast, spec-compliant, positional +information. + +## Installation + +[npm][]: + +```bash +npm install parse-entities +``` + +## Usage + +```js +var decode = require('parse-entities') + +decode('alpha & bravo') +// => alpha & bravo + +decode('charlie ©cat; delta') +// => charlie ©cat; delta + +decode('echo © foxtrot ≠ golf 𝌆 hotel') +// => echo © foxtrot ≠ golf 𝌆 hotel +``` + +## API + +## `parseEntities(value[, options])` + +##### `options` + +###### `options.additional` + +Additional character to accept (`string?`, default: `''`). +This allows other characters, without error, when following an ampersand. + +###### `options.attribute` + +Whether to parse `value` as an attribute value (`boolean?`, default: +`false`). + +###### `options.nonTerminated` + +Whether to allow non-terminated entities (`boolean`, default: `true`). +For example, `©cat` for `©cat`. This behaviour is spec-compliant but +can lead to unexpected results. + +###### `options.warning` + +Error handler ([`Function?`][warning]). + +###### `options.text` + +Text handler ([`Function?`][text]). + +###### `options.reference` + +Reference handler ([`Function?`][reference]). + +###### `options.warningContext` + +Context used when invoking `warning` (`'*'`, optional). + +###### `options.textContext` + +Context used when invoking `text` (`'*'`, optional). + +###### `options.referenceContext` + +Context used when invoking `reference` (`'*'`, optional) + +###### `options.position` + +Starting `position` of `value` (`Location` or `Position`, optional). Useful +when dealing with values nested in some sort of syntax tree. The default is: + +```js +{ + start: {line: 1, column: 1, offset: 0}, + indent: [] +} +``` + +##### Returns + +`string` — Decoded `value`. + +### `function warning(reason, position, code)` + +Error handler. + +##### Context + +`this` refers to `warningContext` when given to `parseEntities`. + +##### Parameters + +###### `reason` + +Human-readable reason for triggering a parse error (`string`). + +###### `position` + +Place at which the parse error occurred (`Position`). + +###### `code` + +Identifier of reason for triggering a parse error (`number`). + +The following codes are used: + +| Code | Example | Note | +| ---- | ------------------ | --------------------------------------------- | +| `1` | `foo & bar` | Missing semicolon (named) | +| `2` | `foo { bar` | Missing semicolon (numeric) | +| `3` | `Foo &bar baz` | Ampersand did not start a reference | +| `4` | `Foo &#` | Empty reference | +| `5` | `Foo &bar; baz` | Unknown entity | +| `6` | `Foo € baz` | [Disallowed reference][invalid] | +| `7` | `Foo � baz` | Prohibited: outside permissible unicode range | + +### `function text(value, location)` + +Text handler. + +##### Context + +`this` refers to `textContext` when given to `parseEntities`. + +##### Parameters + +###### `value` + +String of content (`string`). + +###### `location` + +Location at which `value` starts and ends (`Location`). + +### `function reference(value, location, source)` + +Character reference handler. + +##### Context + +`this` refers to `referenceContext` when given to `parseEntities`. + +##### Parameters + +###### `value` + +Encoded character reference (`string`). + +###### `location` + +Location at which `value` starts and ends (`Location`). + +###### `source` + +Source of character reference (`Location`). + +## Related + +* [`stringify-entities`](https://github.com/wooorm/stringify-entities) + — Encode HTML character references +* [`character-entities`](https://github.com/wooorm/character-entities) + — Info on character entities +* [`character-entities-html4`](https://github.com/wooorm/character-entities-html4) + — Info on HTML4 character entities +* [`character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) + — Info on legacy character entities +* [`character-reference-invalid`](https://github.com/wooorm/character-reference-invalid) + — Info on invalid numeric character references + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/parse-entities.svg + +[build]: https://travis-ci.org/wooorm/parse-entities + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/parse-entities.svg + +[coverage]: https://codecov.io/github/wooorm/parse-entities + +[downloads-badge]: https://img.shields.io/npm/dm/parse-entities.svg + +[downloads]: https://www.npmjs.com/package/parse-entities + +[size-badge]: https://img.shields.io/bundlephobia/minzip/parse-entities.svg + +[size]: https://bundlephobia.com/result?p=parse-entities + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[warning]: #function-warningreason-position-code + +[text]: #function-textvalue-location + +[reference]: #function-referencevalue-location-source + +[invalid]: https://github.com/wooorm/character-reference-invalid diff --git a/node_modules/parse-glob/LICENSE b/node_modules/parse-glob/LICENSE new file mode 100644 index 00000000..65f90aca --- /dev/null +++ b/node_modules/parse-glob/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/parse-glob/README.md b/node_modules/parse-glob/README.md new file mode 100644 index 00000000..000ccd99 --- /dev/null +++ b/node_modules/parse-glob/README.md @@ -0,0 +1,115 @@ +# parse-glob [![NPM version](https://badge.fury.io/js/parse-glob.svg)](http://badge.fury.io/js/parse-glob) [![Build Status](https://travis-ci.org/jonschlinkert/parse-glob.svg)](https://travis-ci.org/jonschlinkert/parse-glob) + +> Parse a glob pattern into an object of tokens. + +**Changes from v1.0.0 to v3.0.4** + +* all path-related properties are now on the `path` object +* all boolean properties are now on the `is` object +* adds `base` property + +See the [properties](#properties) section for details. + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i parse-glob --save +``` + +* parses 1,000+ glob patterns in 29ms (2.3 GHz Intel Core i7) +* Extensive [unit tests](./test.js) (more than 1,000 lines), covering wildcards, globstars, character classes, brace patterns, extglobs, dotfiles and other complex patterns. + +See the tests for [hundreds of examples](./test.js). + +## Usage + +```js +var parseGlob = require('parse-glob'); +``` + +**Example** + +```js +parseGlob('a/b/c/**/*.{yml,json}'); +``` + +**Returns:** + +```js +{ orig: 'a/b/c/**/*.{yml,json}', + is: + { glob: true, + negated: false, + extglob: false, + braces: true, + brackets: false, + globstar: true, + dotfile: false, + dotdir: false }, + glob: '**/*.{yml,json}', + base: 'a/b/c', + path: + { dirname: 'a/b/c/**/', + basename: '*.{yml,json}', + filename: '*', + extname: '.{yml,json}', + ext: '{yml,json}' } } +``` + +## Properties + +The object returned by parseGlob has the following properties: + +* `orig`: a copy of the original, unmodified glob pattern +* `is`: an object with boolean information about the glob: + - `glob`: true if the pattern actually a glob pattern + - `negated`: true if it's a negation pattern (`!**/foo.js`) + - `extglob`: true if it has extglobs (`@(foo|bar)`) + - `braces`: true if it has braces (`{1..2}` or `.{txt,md}`) + - `brackets`: true if it has POSIX brackets (`[[:alpha:]]`) + - `globstar`: true if the pattern has a globstar (double star, `**`) + - `dotfile`: true if the pattern should match dotfiles + - `dotdir`: true if the pattern should match dot-directories (like `.git`) +* `glob`: the glob pattern part of the string, if any +* `base`: the non-glob part of the string, if any +* `path`: file path segments + - `dirname`: directory + - `basename`: file name with extension + - `filename`: file name without extension + - `extname`: file extension with dot + - `ext`: file extension without dot + +## Related +* [glob-base](https://www.npmjs.com/package/glob-base): Returns an object with the (non-glob) base path and the actual pattern. | [homepage](https://github.com/jonschlinkert/glob-base) +* [glob-parent](https://www.npmjs.com/package/glob-parent): Strips glob magic from a string to provide the parent path | [homepage](https://github.com/es128/glob-parent) +* [glob-path-regex](https://www.npmjs.com/package/glob-path-regex): Regular expression for matching the parts of glob pattern. | [homepage](https://github.com/regexps/glob-path-regex) +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern. | [homepage](https://github.com/jonschlinkert/is-glob) +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://www.npmjs.com/package/micromatch) | [homepage](https://github.com/jonschlinkert/micromatch) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/parse-glob/issues/new). + +## 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 © 2014-2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 22, 2015._ \ No newline at end of file diff --git a/node_modules/parse-glob/index.js b/node_modules/parse-glob/index.js new file mode 100644 index 00000000..4ab691af --- /dev/null +++ b/node_modules/parse-glob/index.js @@ -0,0 +1,156 @@ +/*! + * parse-glob + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isGlob = require('is-glob'); +var findBase = require('glob-base'); +var extglob = require('is-extglob'); +var dotfile = require('is-dotfile'); + +/** + * Expose `cache` + */ + +var cache = module.exports.cache = {}; + +/** + * Parse a glob pattern into tokens. + * + * When no paths or '**' are in the glob, we use a + * different strategy for parsing the filename, since + * file names can contain braces and other difficult + * patterns. such as: + * + * - `*.{a,b}` + * - `(**|*.js)` + */ + +module.exports = function parseGlob(glob) { + if (cache.hasOwnProperty(glob)) { + return cache[glob]; + } + + var tok = {}; + tok.orig = glob; + tok.is = {}; + + // unescape dots and slashes in braces/brackets + glob = escape(glob); + + var parsed = findBase(glob); + tok.is.glob = parsed.isGlob; + + tok.glob = parsed.glob; + tok.base = parsed.base; + var segs = /([^\/]*)$/.exec(glob); + + tok.path = {}; + tok.path.dirname = ''; + tok.path.basename = segs[1] || ''; + tok.path.dirname = glob.split(tok.path.basename).join('') || ''; + var basename = (tok.path.basename || '').split('.') || ''; + tok.path.filename = basename[0] || ''; + tok.path.extname = basename.slice(1).join('.') || ''; + tok.path.ext = ''; + + if (isGlob(tok.path.dirname) && !tok.path.basename) { + if (!/\/$/.test(tok.glob)) { + tok.path.basename = tok.glob; + } + tok.path.dirname = tok.base; + } + + if (glob.indexOf('/') === -1 && !tok.is.globstar) { + tok.path.dirname = ''; + tok.path.basename = tok.orig; + } + + var dot = tok.path.basename.indexOf('.'); + if (dot !== -1) { + tok.path.filename = tok.path.basename.slice(0, dot); + tok.path.extname = tok.path.basename.slice(dot); + } + + if (tok.path.extname.charAt(0) === '.') { + var exts = tok.path.extname.split('.'); + tok.path.ext = exts[exts.length - 1]; + } + + // unescape dots and slashes in braces/brackets + tok.glob = unescape(tok.glob); + tok.path.dirname = unescape(tok.path.dirname); + tok.path.basename = unescape(tok.path.basename); + tok.path.filename = unescape(tok.path.filename); + tok.path.extname = unescape(tok.path.extname); + + // Booleans + var is = (glob && tok.is.glob); + tok.is.negated = glob && glob.charAt(0) === '!'; + tok.is.extglob = glob && extglob(glob); + tok.is.braces = has(is, glob, '{'); + tok.is.brackets = has(is, glob, '[:'); + tok.is.globstar = has(is, glob, '**'); + tok.is.dotfile = dotfile(tok.path.basename) || dotfile(tok.path.filename); + tok.is.dotdir = dotdir(tok.path.dirname); + return (cache[glob] = tok); +} + +/** + * Returns true if the glob matches dot-directories. + * + * @param {Object} `tok` The tokens object + * @param {Object} `path` The path object + * @return {Object} + */ + +function dotdir(base) { + if (base.indexOf('/.') !== -1) { + return true; + } + if (base.charAt(0) === '.' && base.charAt(1) !== '/') { + return true; + } + return false; +} + +/** + * Returns true if the pattern has the given `ch`aracter(s) + * + * @param {Object} `glob` The glob pattern. + * @param {Object} `ch` The character to test for + * @return {Object} + */ + +function has(is, glob, ch) { + return is && glob.indexOf(ch) !== -1; +} + +/** + * Escape/unescape utils + */ + +function escape(str) { + var re = /\{([^{}]*?)}|\(([^()]*?)\)|\[([^\[\]]*?)\]/g; + return str.replace(re, function (outter, braces, parens, brackets) { + var inner = braces || parens || brackets; + if (!inner) { return outter; } + return outter.split(inner).join(esc(inner)); + }); +} + +function esc(str) { + str = str.split('/').join('__SLASH__'); + str = str.split('.').join('__DOT__'); + return str; +} + +function unescape(str) { + str = str.split('__SLASH__').join('/'); + str = str.split('__DOT__').join('.'); + return str; +} diff --git a/node_modules/parse-glob/package.json b/node_modules/parse-glob/package.json new file mode 100644 index 00000000..3026cfbb --- /dev/null +++ b/node_modules/parse-glob/package.json @@ -0,0 +1,93 @@ +{ + "_from": "parse-glob@^3.0.4", + "_id": "parse-glob@3.0.4", + "_inBundle": false, + "_integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "_location": "/parse-glob", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "parse-glob@^3.0.4", + "name": "parse-glob", + "escapedName": "parse-glob", + "rawSpec": "^3.0.4", + "saveSpec": null, + "fetchSpec": "^3.0.4" + }, + "_requiredBy": [ + "/micromatch" + ], + "_resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "_shasum": "b2c376cfb11f35513badd173ef0bb6e3a388391c", + "_spec": "parse-glob@^3.0.4", + "_where": "/home/remi/github/CPP_BIDS/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/parse-glob/issues" + }, + "bundleDependencies": false, + "dependencies": { + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" + }, + "deprecated": false, + "description": "Parse a glob pattern into an object of tokens.", + "devDependencies": { + "browserify": "^9.0.3", + "lodash": "^3.3.1", + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/parse-glob", + "keywords": [ + "glob", + "match", + "bash", + "expand", + "expansion", + "expression", + "file", + "files", + "filter", + "find", + "glob", + "globbing", + "globs", + "globstar", + "match", + "matcher", + "matches", + "matching", + "path", + "pattern", + "patterns", + "regex", + "regexp", + "regular", + "shell", + "wildcard" + ], + "license": "MIT", + "main": "index.js", + "name": "parse-glob", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/parse-glob.git" + }, + "scripts": { + "prepublish": "browserify -o browser.js -e index.js", + "test": "mocha" + }, + "version": "3.0.4" +} diff --git a/node_modules/parse-json/index.js b/node_modules/parse-json/index.js new file mode 100644 index 00000000..16f42b4a --- /dev/null +++ b/node_modules/parse-json/index.js @@ -0,0 +1,33 @@ +'use strict'; +const errorEx = require('error-ex'); +const fallback = require('json-parse-better-errors'); + +const JSONError = errorEx('JSONError', { + fileName: errorEx.append('in %s') +}); + +module.exports = (input, reviver, filename) => { + if (typeof reviver === 'string') { + filename = reviver; + reviver = null; + } + + try { + try { + return JSON.parse(input, reviver); + } catch (err) { + fallback(input, reviver); + + throw err; + } + } catch (err) { + err.message = err.message.replace(/\n/g, ''); + + const jsonErr = new JSONError(err); + if (filename) { + jsonErr.fileName = filename; + } + + throw jsonErr; + } +}; diff --git a/node_modules/parse-json/license b/node_modules/parse-json/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/parse-json/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/parse-json/package.json b/node_modules/parse-json/package.json new file mode 100644 index 00000000..681e437f --- /dev/null +++ b/node_modules/parse-json/package.json @@ -0,0 +1,75 @@ +{ + "_from": "parse-json@^4.0.0", + "_id": "parse-json@4.0.0", + "_inBundle": false, + "_integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "_location": "/parse-json", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "parse-json@^4.0.0", + "name": "parse-json", + "escapedName": "parse-json", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/unified-engine" + ], + "_resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "_shasum": "be35f5425be1f7f6c747184f98a788cb99477ee0", + "_spec": "parse-json@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-engine", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/parse-json/issues" + }, + "bundleDependencies": false, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "deprecated": false, + "description": "Parse JSON with more helpful errors", + "devDependencies": { + "ava": "*", + "nyc": "^11.2.1", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js", + "vendor" + ], + "homepage": "https://github.com/sindresorhus/parse-json#readme", + "keywords": [ + "parse", + "json", + "graceful", + "error", + "message", + "humanize", + "friendly", + "helpful", + "string", + "str" + ], + "license": "MIT", + "name": "parse-json", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/parse-json.git" + }, + "scripts": { + "test": "xo && nyc ava" + }, + "version": "4.0.0" +} diff --git a/node_modules/parse-json/readme.md b/node_modules/parse-json/readme.md new file mode 100644 index 00000000..2976e347 --- /dev/null +++ b/node_modules/parse-json/readme.md @@ -0,0 +1,83 @@ +# parse-json [![Build Status](https://travis-ci.org/sindresorhus/parse-json.svg?branch=master)](https://travis-ci.org/sindresorhus/parse-json) + +> Parse JSON with more helpful errors + + +## Install + +``` +$ npm install parse-json +``` + + +## Usage + +```js +const parseJson = require('parse-json'); +const json = '{\n\t"foo": true,\n}'; + + +JSON.parse(json); +/* +undefined:3 +} +^ +SyntaxError: Unexpected token } +*/ + + +parseJson(json); +/* +JSONError: Trailing comma in object at 3:1 +} +^ +*/ + + +parseJson(json, 'foo.json'); +/* +JSONError: Trailing comma in object in foo.json:3:1 +} +^ +*/ + + +// You can also add the filename at a later point +try { + parseJson(json); +} catch (err) { + err.fileName = 'foo.json'; + throw err; +} +/* +JSONError: Trailing comma in object in foo.json:3:1 +} +^ +*/ +``` + +## API + +### parseJson(input, [reviver], [filename]) + +#### input + +Type: `string` + +#### reviver + +Type: `Function` + +Prescribes how the value originally produced by parsing is transformed, before being returned. See [`JSON.parse` docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter +) for more. + +#### filename + +Type: `string` + +Filename displayed in the error message. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/pascalcase/LICENSE b/node_modules/pascalcase/LICENSE new file mode 100644 index 00000000..65f90aca --- /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 00000000..fa3fd00f --- /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 00000000..7e8159ce --- /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 00000000..673dfa3e --- /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": "/home/remi/github/CPP_BIDS/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-is-absolute/index.js b/node_modules/path-is-absolute/index.js new file mode 100644 index 00000000..22aa6c35 --- /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 00000000..654d0bfe --- /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 00000000..ac57b547 --- /dev/null +++ b/node_modules/path-is-absolute/package.json @@ -0,0 +1,76 @@ +{ + "_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", + "/glob" + ], + "_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": "/home/remi/github/CPP_BIDS/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 00000000..8dbdf5fc --- /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/plur/index.d.ts b/node_modules/plur/index.d.ts new file mode 100644 index 00000000..7ba5c843 --- /dev/null +++ b/node_modules/plur/index.d.ts @@ -0,0 +1,38 @@ +/** +Pluralize a word. + +@param word - Word to pluralize. +@param plural - Pluralized word. +The plural suffix will match the case of the last letter in the word. +This option is only for extreme edge-cases. You probably won't need it. + +Default: + +- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/master/irregular-plurals.json). +- Words ending in *s*, *x*, *z*, *ch*, *sh* will be pluralized with *-es* (eg. *foxes*). +- Words ending in *y* that are preceded by a consonant will be pluralized by replacing *y* with *-ies* (eg. *puppies*). +- All other words will have "s" added to the end (eg. *days*). + +@param count - Count to determine whether to use singular or plural. + +@example +``` +import plur = require('plur'); + +plur('unicorn', 4); +//=> 'unicorns' + +plur('puppy', 2); +//=> 'puppies' + +plur('box', 2); +//=> 'boxes' + +plur('cactus', 2); +//=> 'cacti' +``` + */ +declare function plur(word: string, count?: number): string; +declare function plur(word: string, plural: string, count?: number): string; + +export = plur; diff --git a/node_modules/plur/index.js b/node_modules/plur/index.js new file mode 100644 index 00000000..826de8fe --- /dev/null +++ b/node_modules/plur/index.js @@ -0,0 +1,31 @@ +'use strict'; +const irregularPlurals = require('irregular-plurals'); + +module.exports = (word, plural, count) => { + if (typeof plural === 'number') { + count = plural; + } + + if (irregularPlurals.has(word.toLowerCase())) { + plural = irregularPlurals.get(word.toLowerCase()); + + const firstLetter = word.charAt(0); + const isFirstLetterUpperCase = firstLetter === firstLetter.toUpperCase(); + if (isFirstLetterUpperCase) { + plural = firstLetter.toUpperCase() + plural.slice(1); + } + + const isWholeWordUpperCase = word === word.toUpperCase(); + if (isWholeWordUpperCase) { + plural = plural.toUpperCase(); + } + } else if (typeof plural !== 'string') { + plural = (word.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's') + .replace(/i?e?s$/i, match => { + const isTailLowerCase = word.slice(-1) === word.slice(-1).toLowerCase(); + return isTailLowerCase ? match.toLowerCase() : match.toUpperCase(); + }); + } + + return Math.abs(count) === 1 ? word : plural; +}; diff --git a/node_modules/plur/license b/node_modules/plur/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/plur/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/plur/package.json b/node_modules/plur/package.json new file mode 100644 index 00000000..f1662b7c --- /dev/null +++ b/node_modules/plur/package.json @@ -0,0 +1,79 @@ +{ + "_from": "plur@^3.0.0", + "_id": "plur@3.1.1", + "_inBundle": false, + "_integrity": "sha512-t1Ax8KUvV3FFII8ltczPn2tJdjqbd1sIzu6t4JL7nQ3EyeL/lTrj5PWKb06ic5/6XYDr65rQ4uzQEGN70/6X5w==", + "_location": "/plur", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "plur@^3.0.0", + "name": "plur", + "escapedName": "plur", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-list-item-bullet-indent", + "/remark-lint-list-item-indent", + "/remark-lint-no-consecutive-blank-lines", + "/remark-lint-no-heading-content-indent", + "/remark-preset-lint-markdown-style-guide/remark-lint-blockquote-indentation", + "/remark-preset-lint-markdown-style-guide/remark-lint-list-item-content-indent" + ], + "_resolved": "https://registry.npmjs.org/plur/-/plur-3.1.1.tgz", + "_shasum": "60267967866a8d811504fe58f2faaba237546a5b", + "_spec": "plur@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/plur/issues" + }, + "bundleDependencies": false, + "dependencies": { + "irregular-plurals": "^2.0.0" + }, + "deprecated": false, + "description": "Pluralize a word", + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/plur#readme", + "keywords": [ + "plural", + "plurals", + "pluralize", + "singular", + "count", + "word", + "string", + "irregular", + "noun", + "nouns" + ], + "license": "MIT", + "name": "plur", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/plur.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "3.1.1" +} diff --git a/node_modules/plur/readme.md b/node_modules/plur/readme.md new file mode 100644 index 00000000..9fe6e831 --- /dev/null +++ b/node_modules/plur/readme.md @@ -0,0 +1,67 @@ +# plur [![Build Status](https://travis-ci.org/sindresorhus/plur.svg?branch=master)](https://travis-ci.org/sindresorhus/plur) + +> Pluralize a word + + +## Install + +``` +$ npm install plur +``` + + +## Usage + +```js +const plur = require('plur'); + +plur('unicorn', 4); +//=> 'unicorns' + +plur('puppy', 2); +//=> 'puppies' + +plur('box', 2); +//=> 'boxes' + +plur('cactus', 2); +//=> 'cacti' +``` + + +## API + +### plur(word, [plural], count) + +#### word + +Type: `string` + +Word to pluralize. + +#### plural + +Type: `string`
+Default: + +- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/master/irregular-plurals.json). +- Words ending in *s*, *x*, *z*, *ch*, *sh* will be pluralized with *-es* (eg. *foxes*). +- Words ending in *y* that are preceded by a consonant will be pluralized by replacing *y* with *-ies* (eg. *puppies*). +- All other words will have "s" added to the end (eg. *days*). + +Pluralized word. + +The plural suffix will match the case of the last letter in the word. + +This option is only for extreme edge-cases. You probably won't need it. + +#### count + +Type: `number` + +Count to determine whether to use singular or plural. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/pluralize/LICENSE b/node_modules/pluralize/LICENSE new file mode 100644 index 00000000..309c2e3b --- /dev/null +++ b/node_modules/pluralize/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 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/pluralize/Readme.md b/node_modules/pluralize/Readme.md new file mode 100644 index 00000000..c000ada3 --- /dev/null +++ b/node_modules/pluralize/Readme.md @@ -0,0 +1,100 @@ +# Pluralize + +[![NPM version][npm-image]][npm-url] +[![NPM downloads][downloads-image]][downloads-url] +[![Build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +![File Size][filesize-url] +[![CDNJS][cdnjs-image]][cdnjs-url] + +> Pluralize and singularize any word. + +## Installation + +``` +npm install pluralize --save +yarn add pluralize +bower install pluralize --save +``` + +### Node + +```javascript +var pluralize = require('pluralize') +``` + +### AMD + +```javascript +define(function (require, exports, module) { + var pluralize = require('pluralize') +}) +``` + +### ` +``` + +## Why? + +This module uses a pre-defined list of rules, applied in order, to singularize or pluralize a given word. There are many cases where this is useful, such as any automation based on user input. For applications where the word(s) are known ahead of time, you can use a simple ternary (or function) which would be a much lighter alternative. + +## Usage + +* `word: string` The word to pluralize +* `count: number` How many of the word exist +* `inclusive: boolean` Whether to prefix with the number (e.g. 3 ducks) + +Examples: + +```javascript +pluralize('test') //=> "tests" +pluralize('test', 0) //=> "tests" +pluralize('test', 1) //=> "test" +pluralize('test', 5) //=> "tests" +pluralize('test', 1, true) //=> "1 test" +pluralize('test', 5, true) //=> "5 tests" +pluralize('蘋果', 2, true) //=> "2 蘋果" + +// Example of new plural rule: +pluralize.plural('regex') //=> "regexes" +pluralize.addPluralRule(/gex$/i, 'gexii') +pluralize.plural('regex') //=> "regexii" + +// Example of new singular rule: +pluralize.singular('singles') //=> "single" +pluralize.addSingularRule(/singles$/i, 'singular') +pluralize.singular('singles') //=> "singular" + +// Example of new irregular rule, e.g. "I" -> "we": +pluralize.plural('irregular') //=> "irregulars" +pluralize.addIrregularRule('irregular', 'regular') +pluralize.plural('irregular') //=> "regular" + +// Example of uncountable rule (rules without singular/plural in context): +pluralize.plural('paper') //=> "papers" +pluralize.addUncountableRule('paper') +pluralize.plural('paper') //=> "paper" + +// Example of asking whether a word looks singular or plural: +pluralize.isPlural('test') //=> false +pluralize.isSingular('test') //=> true +``` + +## License + +MIT + +[npm-image]: https://img.shields.io/npm/v/pluralize.svg?style=flat +[npm-url]: https://npmjs.org/package/pluralize +[downloads-image]: https://img.shields.io/npm/dm/pluralize.svg?style=flat +[downloads-url]: https://npmjs.org/package/pluralize +[travis-image]: https://img.shields.io/travis/blakeembrey/pluralize.svg?style=flat +[travis-url]: https://travis-ci.org/blakeembrey/pluralize +[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/pluralize.svg?style=flat +[coveralls-url]: https://coveralls.io/r/blakeembrey/pluralize?branch=master +[filesize-url]: https://img.shields.io/github/size/blakeembrey/pluralize/pluralize.js.svg?style=flat +[cdnjs-image]: https://img.shields.io/cdnjs/v/pluralize.svg +[cdnjs-url]: https://cdnjs.com/libraries/pluralize diff --git a/node_modules/pluralize/package.json b/node_modules/pluralize/package.json new file mode 100644 index 00000000..83b82d53 --- /dev/null +++ b/node_modules/pluralize/package.json @@ -0,0 +1,72 @@ +{ + "_from": "pluralize@^8.0.0", + "_id": "pluralize@8.0.0", + "_inBundle": false, + "_integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "_location": "/pluralize", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pluralize@^8.0.0", + "name": "pluralize", + "escapedName": "pluralize", + "rawSpec": "^8.0.0", + "saveSpec": null, + "fetchSpec": "^8.0.0" + }, + "_requiredBy": [ + "/remark-lint-blockquote-indentation", + "/remark-lint-list-item-content-indent" + ], + "_resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "_shasum": "1a6fa16a38d12a1901e0320fa017051c539ce3b1", + "_spec": "pluralize@^8.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-blockquote-indentation", + "author": { + "name": "Blake Embrey", + "email": "hello@blakeembrey.com", + "url": "http://blakeembrey.me" + }, + "bugs": { + "url": "https://github.com/blakeembrey/pluralize/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Pluralize and singularize any word", + "devDependencies": { + "chai": "^4.0.0", + "istanbul": "^0.4.5", + "mocha": "^5.0.0", + "semistandard": "^12.0.0" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "pluralize.js" + ], + "homepage": "https://github.com/blakeembrey/pluralize#readme", + "keywords": [ + "plural", + "plurals", + "pluralize", + "singular", + "singularize", + "inflection" + ], + "license": "MIT", + "main": "pluralize.js", + "name": "pluralize", + "repository": { + "type": "git", + "url": "git+https://github.com/blakeembrey/pluralize.git" + }, + "scripts": { + "lint": "semistandard", + "test": "npm run lint && npm run test-cov", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail", + "test-spec": "mocha -R spec --bail" + }, + "version": "8.0.0" +} diff --git a/node_modules/pluralize/pluralize.js b/node_modules/pluralize/pluralize.js new file mode 100644 index 00000000..b8f970ad --- /dev/null +++ b/node_modules/pluralize/pluralize.js @@ -0,0 +1,503 @@ +/* global define */ + +(function (root, pluralize) { + /* istanbul ignore else */ + if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') { + // Node. + module.exports = pluralize(); + } else if (typeof define === 'function' && define.amd) { + // AMD, registers as an anonymous module. + define(function () { + return pluralize(); + }); + } else { + // Browser global. + root.pluralize = pluralize(); + } +})(this, function () { + // Rule storage - pluralize and singularize need to be run sequentially, + // while other rules can be optimized using an object for instant lookups. + var pluralRules = []; + var singularRules = []; + var uncountables = {}; + var irregularPlurals = {}; + var irregularSingles = {}; + + /** + * Sanitize a pluralization rule to a usable regular expression. + * + * @param {(RegExp|string)} rule + * @return {RegExp} + */ + function sanitizeRule (rule) { + if (typeof rule === 'string') { + return new RegExp('^' + rule + '$', 'i'); + } + + return rule; + } + + /** + * Pass in a word token to produce a function that can replicate the case on + * another word. + * + * @param {string} word + * @param {string} token + * @return {Function} + */ + function restoreCase (word, token) { + // Tokens are an exact match. + if (word === token) return token; + + // Lower cased words. E.g. "hello". + if (word === word.toLowerCase()) return token.toLowerCase(); + + // Upper cased words. E.g. "WHISKY". + if (word === word.toUpperCase()) return token.toUpperCase(); + + // Title cased words. E.g. "Title". + if (word[0] === word[0].toUpperCase()) { + return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase(); + } + + // Lower cased words. E.g. "test". + return token.toLowerCase(); + } + + /** + * Interpolate a regexp string. + * + * @param {string} str + * @param {Array} args + * @return {string} + */ + function interpolate (str, args) { + return str.replace(/\$(\d{1,2})/g, function (match, index) { + return args[index] || ''; + }); + } + + /** + * Replace a word using a rule. + * + * @param {string} word + * @param {Array} rule + * @return {string} + */ + function replace (word, rule) { + return word.replace(rule[0], function (match, index) { + var result = interpolate(rule[1], arguments); + + if (match === '') { + return restoreCase(word[index - 1], result); + } + + return restoreCase(match, result); + }); + } + + /** + * Sanitize a word by passing in the word and sanitization rules. + * + * @param {string} token + * @param {string} word + * @param {Array} rules + * @return {string} + */ + function sanitizeWord (token, word, rules) { + // Empty string or doesn't need fixing. + if (!token.length || uncountables.hasOwnProperty(token)) { + return word; + } + + var len = rules.length; + + // Iterate over the sanitization rules and use the first one to match. + while (len--) { + var rule = rules[len]; + + if (rule[0].test(word)) return replace(word, rule); + } + + return word; + } + + /** + * Replace a word with the updated word. + * + * @param {Object} replaceMap + * @param {Object} keepMap + * @param {Array} rules + * @return {Function} + */ + function replaceWord (replaceMap, keepMap, rules) { + return function (word) { + // Get the correct token and case restoration functions. + var token = word.toLowerCase(); + + // Check against the keep object map. + if (keepMap.hasOwnProperty(token)) { + return restoreCase(word, token); + } + + // Check against the replacement map for a direct word replacement. + if (replaceMap.hasOwnProperty(token)) { + return restoreCase(word, replaceMap[token]); + } + + // Run all the rules against the word. + return sanitizeWord(token, word, rules); + }; + } + + /** + * Check if a word is part of the map. + */ + function checkWord (replaceMap, keepMap, rules, bool) { + return function (word) { + var token = word.toLowerCase(); + + if (keepMap.hasOwnProperty(token)) return true; + if (replaceMap.hasOwnProperty(token)) return false; + + return sanitizeWord(token, token, rules) === token; + }; + } + + /** + * Pluralize or singularize a word based on the passed in count. + * + * @param {string} word The word to pluralize + * @param {number} count How many of the word exist + * @param {boolean} inclusive Whether to prefix with the number (e.g. 3 ducks) + * @return {string} + */ + function pluralize (word, count, inclusive) { + var pluralized = count === 1 + ? pluralize.singular(word) : pluralize.plural(word); + + return (inclusive ? count + ' ' : '') + pluralized; + } + + /** + * Pluralize a word. + * + * @type {Function} + */ + pluralize.plural = replaceWord( + irregularSingles, irregularPlurals, pluralRules + ); + + /** + * Check if a word is plural. + * + * @type {Function} + */ + pluralize.isPlural = checkWord( + irregularSingles, irregularPlurals, pluralRules + ); + + /** + * Singularize a word. + * + * @type {Function} + */ + pluralize.singular = replaceWord( + irregularPlurals, irregularSingles, singularRules + ); + + /** + * Check if a word is singular. + * + * @type {Function} + */ + pluralize.isSingular = checkWord( + irregularPlurals, irregularSingles, singularRules + ); + + /** + * Add a pluralization rule to the collection. + * + * @param {(string|RegExp)} rule + * @param {string} replacement + */ + pluralize.addPluralRule = function (rule, replacement) { + pluralRules.push([sanitizeRule(rule), replacement]); + }; + + /** + * Add a singularization rule to the collection. + * + * @param {(string|RegExp)} rule + * @param {string} replacement + */ + pluralize.addSingularRule = function (rule, replacement) { + singularRules.push([sanitizeRule(rule), replacement]); + }; + + /** + * Add an uncountable word rule. + * + * @param {(string|RegExp)} word + */ + pluralize.addUncountableRule = function (word) { + if (typeof word === 'string') { + uncountables[word.toLowerCase()] = true; + return; + } + + // Set singular and plural references for the word. + pluralize.addPluralRule(word, '$0'); + pluralize.addSingularRule(word, '$0'); + }; + + /** + * Add an irregular word definition. + * + * @param {string} single + * @param {string} plural + */ + pluralize.addIrregularRule = function (single, plural) { + plural = plural.toLowerCase(); + single = single.toLowerCase(); + + irregularSingles[single] = plural; + irregularPlurals[plural] = single; + }; + + /** + * Irregular rules. + */ + [ + // Pronouns. + ['I', 'we'], + ['me', 'us'], + ['he', 'they'], + ['she', 'they'], + ['them', 'them'], + ['myself', 'ourselves'], + ['yourself', 'yourselves'], + ['itself', 'themselves'], + ['herself', 'themselves'], + ['himself', 'themselves'], + ['themself', 'themselves'], + ['is', 'are'], + ['was', 'were'], + ['has', 'have'], + ['this', 'these'], + ['that', 'those'], + // Words ending in with a consonant and `o`. + ['echo', 'echoes'], + ['dingo', 'dingoes'], + ['volcano', 'volcanoes'], + ['tornado', 'tornadoes'], + ['torpedo', 'torpedoes'], + // Ends with `us`. + ['genus', 'genera'], + ['viscus', 'viscera'], + // Ends with `ma`. + ['stigma', 'stigmata'], + ['stoma', 'stomata'], + ['dogma', 'dogmata'], + ['lemma', 'lemmata'], + ['schema', 'schemata'], + ['anathema', 'anathemata'], + // Other irregular rules. + ['ox', 'oxen'], + ['axe', 'axes'], + ['die', 'dice'], + ['yes', 'yeses'], + ['foot', 'feet'], + ['eave', 'eaves'], + ['goose', 'geese'], + ['tooth', 'teeth'], + ['quiz', 'quizzes'], + ['human', 'humans'], + ['proof', 'proofs'], + ['carve', 'carves'], + ['valve', 'valves'], + ['looey', 'looies'], + ['thief', 'thieves'], + ['groove', 'grooves'], + ['pickaxe', 'pickaxes'], + ['passerby', 'passersby'] + ].forEach(function (rule) { + return pluralize.addIrregularRule(rule[0], rule[1]); + }); + + /** + * Pluralization rules. + */ + [ + [/s?$/i, 's'], + [/[^\u0000-\u007F]$/i, '$0'], + [/([^aeiou]ese)$/i, '$1'], + [/(ax|test)is$/i, '$1es'], + [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'], + [/(e[mn]u)s?$/i, '$1s'], + [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'], + [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'], + [/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'], + [/(seraph|cherub)(?:im)?$/i, '$1im'], + [/(her|at|gr)o$/i, '$1oes'], + [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'], + [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'], + [/sis$/i, 'ses'], + [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'], + [/([^aeiouy]|qu)y$/i, '$1ies'], + [/([^ch][ieo][ln])ey$/i, '$1ies'], + [/(x|ch|ss|sh|zz)$/i, '$1es'], + [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'], + [/\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'], + [/(pe)(?:rson|ople)$/i, '$1ople'], + [/(child)(?:ren)?$/i, '$1ren'], + [/eaux$/i, '$0'], + [/m[ae]n$/i, 'men'], + ['thou', 'you'] + ].forEach(function (rule) { + return pluralize.addPluralRule(rule[0], rule[1]); + }); + + /** + * Singularization rules. + */ + [ + [/s$/i, ''], + [/(ss)$/i, '$1'], + [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'], + [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'], + [/ies$/i, 'y'], + [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'], + [/\b(mon|smil)ies$/i, '$1ey'], + [/\b((?:tit)?m|l)ice$/i, '$1ouse'], + [/(seraph|cherub)im$/i, '$1'], + [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'], + [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'], + [/(movie|twelve|abuse|e[mn]u)s$/i, '$1'], + [/(test)(?:is|es)$/i, '$1is'], + [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'], + [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'], + [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'], + [/(alumn|alg|vertebr)ae$/i, '$1a'], + [/(cod|mur|sil|vert|ind)ices$/i, '$1ex'], + [/(matr|append)ices$/i, '$1ix'], + [/(pe)(rson|ople)$/i, '$1rson'], + [/(child)ren$/i, '$1'], + [/(eau)x?$/i, '$1'], + [/men$/i, 'man'] + ].forEach(function (rule) { + return pluralize.addSingularRule(rule[0], rule[1]); + }); + + /** + * Uncountable rules. + */ + [ + // Singular words with no plurals. + 'adulthood', + 'advice', + 'agenda', + 'aid', + 'aircraft', + 'alcohol', + 'ammo', + 'analytics', + 'anime', + 'athletics', + 'audio', + 'bison', + 'blood', + 'bream', + 'buffalo', + 'butter', + 'carp', + 'cash', + 'chassis', + 'chess', + 'clothing', + 'cod', + 'commerce', + 'cooperation', + 'corps', + 'debris', + 'diabetes', + 'digestion', + 'elk', + 'energy', + 'equipment', + 'excretion', + 'expertise', + 'firmware', + 'flounder', + 'fun', + 'gallows', + 'garbage', + 'graffiti', + 'hardware', + 'headquarters', + 'health', + 'herpes', + 'highjinks', + 'homework', + 'housework', + 'information', + 'jeans', + 'justice', + 'kudos', + 'labour', + 'literature', + 'machinery', + 'mackerel', + 'mail', + 'media', + 'mews', + 'moose', + 'music', + 'mud', + 'manga', + 'news', + 'only', + 'personnel', + 'pike', + 'plankton', + 'pliers', + 'police', + 'pollution', + 'premises', + 'rain', + 'research', + 'rice', + 'salmon', + 'scissors', + 'series', + 'sewage', + 'shambles', + 'shrimp', + 'software', + 'species', + 'staff', + 'swine', + 'tennis', + 'traffic', + 'transportation', + 'trout', + 'tuna', + 'wealth', + 'welfare', + 'whiting', + 'wildebeest', + 'wildlife', + 'you', + /pok[eé]mon$/i, + // Regexes. + /[^aeiou]ese$/i, // "chinese", "japanese" + /deer$/i, // "deer", "reindeer" + /fish$/i, // "fish", "blowfish", "angelfish" + /measles$/i, + /o[iu]s$/i, // "carnivorous" + /pox$/i, // "chickpox", "smallpox" + /sheep$/i + ].forEach(pluralize.addUncountableRule); + + return pluralize; +}); diff --git a/node_modules/posix-character-classes/LICENSE b/node_modules/posix-character-classes/LICENSE new file mode 100644 index 00000000..b11cb796 --- /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 00000000..894ae237 --- /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 00000000..19f1c986 --- /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 00000000..4f714fe9 --- /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": [ + "/readdirp/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": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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/preserve/.gitattributes b/node_modules/preserve/.gitattributes new file mode 100644 index 00000000..759c2c5a --- /dev/null +++ b/node_modules/preserve/.gitattributes @@ -0,0 +1,14 @@ +# Enforce Unix newlines +*.* text eol=lf +*.css text eol=lf +*.html text eol=lf +*.js text eol=lf +*.json text eol=lf +*.less text eol=lf +*.md text eol=lf +*.yml text eol=lf + +*.jpg binary +*.gif binary +*.png binary +*.jpeg binary \ No newline at end of file diff --git a/node_modules/preserve/.jshintrc b/node_modules/preserve/.jshintrc new file mode 100644 index 00000000..e72045d2 --- /dev/null +++ b/node_modules/preserve/.jshintrc @@ -0,0 +1,24 @@ +{ + "asi": false, + "boss": true, + "curly": true, + "eqeqeq": true, + "eqnull": true, + "esnext": true, + "immed": true, + "latedef": true, + "laxcomma": false, + "newcap": true, + "noarg": true, + "node": true, + "sub": true, + "undef": true, + "unused": true, + "globals": { + "define": true, + "before": true, + "after": true, + "describe": true, + "it": true + } +} \ No newline at end of file diff --git a/node_modules/preserve/.npmignore b/node_modules/preserve/.npmignore new file mode 100644 index 00000000..1a2e47f0 --- /dev/null +++ b/node_modules/preserve/.npmignore @@ -0,0 +1,53 @@ +# Numerous always-ignore extensions +*.csv +*.dat +*.diff +*.err +*.gz +*.log +*.orig +*.out +*.pid +*.rar +*.rej +*.seed +*.swo +*.swp +*.vi +*.yo-rc.json +*.zip +*~ +.ruby-version +lib-cov +npm-debug.log + +# Always-ignore dirs +/bower_components/ +/node_modules/ +/temp/ +/tmp/ +/vendor/ +_gh_pages + +# OS or Editor folders +*.esproj +*.komodoproject +.komodotools +*.sublime-* +._* +.cache +.DS_Store +.idea +.project +.settings +.tmproj +nbproject +Thumbs.db + +# grunt-html-validation +validation-status.json +validation-report.json + +# misc +TODO.md +benchmark \ No newline at end of file diff --git a/node_modules/preserve/.travis.yml b/node_modules/preserve/.travis.yml new file mode 100644 index 00000000..ff74a054 --- /dev/null +++ b/node_modules/preserve/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - '0.10' \ No newline at end of file diff --git a/node_modules/preserve/.verb.md b/node_modules/preserve/.verb.md new file mode 100644 index 00000000..72344a9e --- /dev/null +++ b/node_modules/preserve/.verb.md @@ -0,0 +1,59 @@ +# {%= name %} {%= badge("fury") %} + +> {%= description %} + +Useful for protecting tokens, like templates in HTML, from being mutated when the string is transformed in some way, like from a formatter/beautifier. + +**Example without `preserve`** + +Let's say you want to use [js-beautify] on a string of html with Lo-Dash/Underscore templates, such as: `
  • <%= name %>
`: + +js-beautify will render the template unusable (and apply incorrect formatting because of the unfamiliar syntax from the Lo-Dash template): + +```html +
    +
  • + <%=n ame %> +
  • +
+``` + +**Example with `preserve`** + +Correct. + +```html +
    +
  • <%= name %>
  • +
+``` + +For the record, this is just a random example, I've had very few issues with js-beautify in general. But with or without js-beautify, this kind of token mangling does happen sometimes when you use formatters, beautifiers or similar tools. + +## Install +{%= include("install-npm", {save: true}) %} + +## Run tests + +```bash +npm test +``` + +## API +{%= apidocs("index.js") %} + +## Contributing +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %}) + +## Author +{%= include("author") %} + +## License +{%= copyright() %} +{%= license() %} + +*** + +{%= include("footer") %} + +[js-beautify]: https://github.com/beautify-web/js-beautify \ No newline at end of file diff --git a/node_modules/preserve/LICENSE b/node_modules/preserve/LICENSE new file mode 100644 index 00000000..5a9956a7 --- /dev/null +++ b/node_modules/preserve/LICENSE @@ -0,0 +1,24 @@ +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/preserve/README.md b/node_modules/preserve/README.md new file mode 100644 index 00000000..75000b93 --- /dev/null +++ b/node_modules/preserve/README.md @@ -0,0 +1,90 @@ +# preserve [![NPM version](https://badge.fury.io/js/preserve.svg)](http://badge.fury.io/js/preserve) + +> Temporarily substitute tokens in the given `string` with placeholders, then put them back after transforming the string. + +Useful for protecting tokens, like templates in HTML, from being mutated when the string is transformed in some way, like from a formatter/beautifier. + +**Example without `preserve`** + +Let's say you want to use [js-beautify] on a string of html with Lo-Dash/Underscore templates, such as: `
  • <%= name %>
`: + +js-beautify will render the template unusable (and apply incorrect formatting because of the unfamiliar syntax from the Lo-Dash template): + +```html +
    +
  • + <%=n ame %> +
  • +
+``` + +**Example with `preserve`** + +Correct. + +```html +
    +
  • <%= name %>
  • +
+``` + +For the record, this is just a random example, I've had very few issues with js-beautify in general. But with or without js-beautify, this kind of token mangling does happen sometimes when you use formatters, beautifiers or similar tools. + +## Install +## Install with [npm](npmjs.org) + +```bash +npm i preserve --save +``` + +## Run tests + +```bash +npm test +``` + +## API +### [.before](index.js#L23) + +Replace tokens in `str` with a temporary, heuristic placeholder. + +* `str` **{String}** +* `returns` **{String}**: String with placeholders. + +```js +tokens.before('{a\\,b}'); +//=> '{__ID1__}' +``` + +### [.after](index.js#L44) + +Replace placeholders in `str` with original tokens. + +* `str` **{String}**: String with placeholders +* `returns` **{String}** `str`: String with original tokens. + +```js +tokens.after('{__ID1__}'); +//=> '{a\\,b}' +``` + + +## Contributing +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/preserve/issues) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License +Copyright (c) 2015-2015, Jon Schlinkert. +Released under the MIT license + +*** + +_This file was generated by [verb](https://github.com/assemble/verb) on January 10, 2015._ + +[js-beautify]: https://github.com/beautify-web/js-beautify \ No newline at end of file diff --git a/node_modules/preserve/index.js b/node_modules/preserve/index.js new file mode 100644 index 00000000..a6c5d481 --- /dev/null +++ b/node_modules/preserve/index.js @@ -0,0 +1,54 @@ +/*! + * preserve + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT license. + */ + +'use strict'; + +/** + * Replace tokens in `str` with a temporary, heuristic placeholder. + * + * ```js + * tokens.before('{a\\,b}'); + * //=> '{__ID1__}' + * ``` + * + * @param {String} `str` + * @return {String} String with placeholders. + * @api public + */ + +exports.before = function before(str, re) { + return str.replace(re, function (match) { + var id = randomize(); + cache[id] = match; + return '__ID' + id + '__'; + }); +}; + +/** + * Replace placeholders in `str` with original tokens. + * + * ```js + * tokens.after('{__ID1__}'); + * //=> '{a\\,b}' + * ``` + * + * @param {String} `str` String with placeholders + * @return {String} `str` String with original tokens. + * @api public + */ + +exports.after = function after(str) { + return str.replace(/__ID(.{5})__/g, function (_, id) { + return cache[id]; + }); +}; + +function randomize() { + return Math.random().toString().slice(2, 7); +} + +var cache = {}; \ No newline at end of file diff --git a/node_modules/preserve/package.json b/node_modules/preserve/package.json new file mode 100644 index 00000000..46de0f54 --- /dev/null +++ b/node_modules/preserve/package.json @@ -0,0 +1,73 @@ +{ + "_from": "preserve@^0.2.0", + "_id": "preserve@0.2.0", + "_inBundle": false, + "_integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "_location": "/preserve", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "preserve@^0.2.0", + "name": "preserve", + "escapedName": "preserve", + "rawSpec": "^0.2.0", + "saveSpec": null, + "fetchSpec": "^0.2.0" + }, + "_requiredBy": [ + "/braces" + ], + "_resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "_shasum": "815ed1f6ebc65926f865b310c0713bcb3315ce4b", + "_spec": "preserve@^0.2.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/preserve/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Temporarily substitute tokens in the given `string` with placeholders, then put them back after transforming the string.", + "devDependencies": { + "benchmarked": "^0.1.3", + "chalk": "^0.5.1", + "js-beautify": "^1.5.4", + "mocha": "*", + "should": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "homepage": "https://github.com/jonschlinkert/preserve", + "keywords": [ + "escape", + "format", + "placeholder", + "placeholders", + "prettify", + "regex", + "replace", + "template", + "templates", + "token", + "tokens" + ], + "license": { + "type": "MIT", + "url": "https://github.com/jonschlinkert/preserve/blob/master/LICENSE-MIT" + }, + "main": "index.js", + "name": "preserve", + "repository": { + "type": "git", + "url": "git://github.com/jonschlinkert/preserve.git" + }, + "scripts": { + "test": "mocha -R spec" + }, + "version": "0.2.0" +} diff --git a/node_modules/preserve/test.js b/node_modules/preserve/test.js new file mode 100644 index 00000000..9bf174f1 --- /dev/null +++ b/node_modules/preserve/test.js @@ -0,0 +1,48 @@ +/*! + * preserve + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License + */ + +'use strict'; + +var should = require('should'); +var tokens = require('./'); + +var re = /<%=\s*[^>]+%>/g; +var pretty = function(str) { + return require('js-beautify').html(str, { + indent_char: ' ', + indent_size: 2, + }); +}; + +describe('preserve tokens', function () { + var testRe = /__ID.{5}__\n__ID.{5}__\n__ID.{5}__/; + var re = /<%=\s*[^>]+%>/g; + + it('should (e.g. shouldn\'t, but will) mangle tokens in the given string', function () { + var html = pretty('
  • <%= name %>
'); + html.should.equal('
    \n
  • \n <%=n ame %>\n
  • \n
'); + }); + + it('should preserve tokens in the given string', function () { + var html = tokens.after(pretty(tokens.before('
  • <%= name %>
', re))); + html.should.equal('
    \n
  • <%= name %>
  • \n
'); + }); + + describe('.before()', function () { + it('should replace matches with placeholder tokens:', function () { + tokens.before('<%= a %>\n<%= b %>\n<%= c %>', re).should.match(testRe); + }); + }); + + describe('tokens.after()', function () { + it('should replace placeholder tokens with original values:', function () { + var before = tokens.before('<%= a %>\n<%= b %>\n<%= c %>', re); + before.should.match(testRe); + tokens.after(before).should.equal('<%= a %>\n<%= b %>\n<%= c %>'); + }); + }); +}); diff --git a/node_modules/process-nextick-args/index.js b/node_modules/process-nextick-args/index.js new file mode 100644 index 00000000..3eecf114 --- /dev/null +++ b/node_modules/process-nextick-args/index.js @@ -0,0 +1,45 @@ +'use strict'; + +if (typeof process === 'undefined' || + !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 00000000..c67e3532 --- /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 00000000..e674a804 --- /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.1", + "_inBundle": false, + "_integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "_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.1.tgz", + "_shasum": "7820d9b16120cc55ca9ae7792680ae7dba6d7fe2", + "_spec": "process-nextick-args@~2.0.0", + "_where": "/home/remi/github/CPP_BIDS/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.1" +} diff --git a/node_modules/process-nextick-args/readme.md b/node_modules/process-nextick-args/readme.md new file mode 100644 index 00000000..ecb432c9 --- /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/randomatic/LICENSE b/node_modules/randomatic/LICENSE new file mode 100644 index 00000000..38a4a0bf --- /dev/null +++ b/node_modules/randomatic/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-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/randomatic/README.md b/node_modules/randomatic/README.md new file mode 100644 index 00000000..292e6422 --- /dev/null +++ b/node_modules/randomatic/README.md @@ -0,0 +1,193 @@ +# randomatic [![NPM version](https://img.shields.io/npm/v/randomatic.svg?style=flat)](https://www.npmjs.com/package/randomatic) [![NPM monthly downloads](https://img.shields.io/npm/dm/randomatic.svg?style=flat)](https://npmjs.org/package/randomatic) [![NPM total downloads](https://img.shields.io/npm/dt/randomatic.svg?style=flat)](https://npmjs.org/package/randomatic) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/randomatic.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/randomatic) + +> Generate randomized strings of a specified length using simple character sequences. The original generate-password. + +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 randomatic +``` + +## Usage + +```js +var randomize = require('randomatic'); +``` + +## API + +```js +randomize(pattern, length, options); +randomize.isCrypto; +``` + +* `pattern` **{String}**: (required) The pattern to use for randomizing +* `length` **{Number}**: (optional) The length of the string to generate +* `options` **{Object}**: (optional) See available [options](#options) +* `randomize.isCrypto` will be `true` when a cryptographically secure function is being used to generate random numbers. The value will be `false` when the function in use is `Math.random`. + +### pattern + +> The pattern to use for randomizing + +Patterns can contain any combination of the below characters, specified in any order. + +**Example:** + +To generate a 10-character randomized string using all available characters: + +```js +randomize('*', 10); +//=> 'x2_^-5_T[$' + +randomize('Aa0!', 10); +//=> 'LV3u~BSGhw' +``` + +* `a`: Lowercase alpha characters (`abcdefghijklmnopqrstuvwxyz'`) +* `A`: Uppercase alpha characters (`ABCDEFGHIJKLMNOPQRSTUVWXYZ'`) +* `0`: Numeric characters (`0123456789'`) +* `!`: Special characters (`~!@#$%^&()_+-={}[];\',.`) +* `*`: All characters (all of the above combined) +* `?`: Custom characters (pass a string of custom characters to the options) + +### length + +> The length of the string to generate + +**Examples:** + +* `randomize('A', 5)` will generate a 5-character, uppercase, alphabetical, randomized string, e.g. `KDJWJ`. +* `randomize('0', 2)` will generate a 2-digit random number +* `randomize('0', 3)` will generate a 3-digit random number +* `randomize('0', 12)` will generate a 12-digit random number +* `randomize('A0', 16)` will generate a 16-character, alpha-numeric randomized string + +If `length` is left undefined, the length of the pattern in the first parameter will be used. For example: + +* `randomize('00')` will generate a 2-digit random number +* `randomize('000')` will generate a 3-digit random number +* `randomize('0000')` will generate a 4-digit random number... +* `randomize('AAAAA')` will generate a 5-character, uppercase alphabetical random string... + +These are just examples, [see the tests](./test.js) for more use cases and examples. + +## options + +> These are options that can be passed as the third argument. + +#### chars + +Type: `String` + +Default: `undefined` + +Define a custom string to be randomized. + +**Example:** + +* `randomize('?', 20, {chars: 'jonschlinkert'})` will generate a 20-character randomized string from the letters contained in `jonschlinkert`. +* `randomize('?', {chars: 'jonschlinkert'})` will generate a 13-character randomized string from the letters contained in `jonschlinkert`. + +#### exclude + +Type: `String|Array` + +Default: `undefined` + +Specify a string or array of characters can are excluded from the possible characters used to generate the randomized string. + +**Example:** + +* `randomize('*', 20, { exclude: '0oOiIlL1' })` will generate a 20-character randomized string using all of possible characters except for `0oOiIlL1`. + +## Usage Examples + +* `randomize('A', 4)` (_whitespace insenstive_) would result in randomized 4-digit uppercase letters, like, `ZAKH`, `UJSL`... etc. +* `randomize('AAAA')` is equivelant to `randomize('A', 4)` +* `randomize('AAA0')` and `randomize('AA00')` and `randomize('A0A0')` are equivelant to `randomize('A0', 4)` +* `randomize('aa')`: results in double-digit, randomized, lower-case letters (`abcdefghijklmnopqrstuvwxyz`) +* `randomize('AAA')`: results in triple-digit, randomized, upper-case letters (`ABCDEFGHIJKLMNOPQRSTUVWXYZ`) +* `randomize('0', 6)`: results in six-digit, randomized numbers (`0123456789`) +* `randomize('!', 5)`: results in single-digit randomized, _valid_ non-letter characters (`~!@#$%^&()_+-={}[] +* `randomize('A!a0', 9)`: results in nine-digit, randomized characters (any of the above) + +_The order in which the characters are defined is insignificant._ + +## 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: + +* [pad-left](https://www.npmjs.com/package/pad-left): Left pad a string with zeros or a specified string. Fastest implementation. | [homepage](https://github.com/jonschlinkert/pad-left "Left pad a string with zeros or a specified string. Fastest implementation.") +* [pad-right](https://www.npmjs.com/package/pad-right): Right pad a string with zeros or a specified string. Fastest implementation. | [homepage](https://github.com/jonschlinkert/pad-right "Right pad a string with zeros or a specified string. Fastest implementation.") +* [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.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 56 | [jonschlinkert](https://github.com/jonschlinkert) | +| 6 | [doowb](https://github.com/doowb) | +| 4 | [kivlor](https://github.com/kivlor) | +| 2 | [realityking](https://github.com/realityking) | +| 2 | [ywpark1](https://github.com/ywpark1) | +| 1 | [TrySound](https://github.com/TrySound) | +| 1 | [drag0s](https://github.com/drag0s) | +| 1 | [paulmillr](https://github.com/paulmillr) | +| 1 | [sunknudsen](https://github.com/sunknudsen) | +| 1 | [faizulhaque-tp](https://github.com/faizulhaque-tp) | +| 1 | [michaelrhodes](https://github.com/michaelrhodes) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/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.8.0, on October 23, 2018._ \ No newline at end of file diff --git a/node_modules/randomatic/index.js b/node_modules/randomatic/index.js new file mode 100644 index 00000000..dc636fb1 --- /dev/null +++ b/node_modules/randomatic/index.js @@ -0,0 +1,95 @@ +/*! + * randomatic + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var isNumber = require('is-number'); +var typeOf = require('kind-of'); +var mathRandom = require('math-random'); + +/** + * Expose `randomatic` + */ + +module.exports = randomatic; +module.exports.isCrypto = !!mathRandom.cryptographic; + +/** + * Available mask characters + */ + +var type = { + lower: 'abcdefghijklmnopqrstuvwxyz', + upper: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + number: '0123456789', + special: '~!@#$%^&()_+-={}[];\',.' +}; + +type.all = type.lower + type.upper + type.number + type.special; + +/** + * Generate random character sequences of a specified `length`, + * based on the given `pattern`. + * + * @param {String} `pattern` The pattern to use for generating the random string. + * @param {String} `length` The length of the string to generate. + * @param {String} `options` + * @return {String} + * @api public + */ + +function randomatic(pattern, length, options) { + if (typeof pattern === 'undefined') { + throw new Error('randomatic expects a string or number.'); + } + + var custom = false; + if (arguments.length === 1) { + if (typeof pattern === 'string') { + length = pattern.length; + + } else if (isNumber(pattern)) { + options = {}; + length = pattern; + pattern = '*'; + } + } + + if (typeOf(length) === 'object' && length.hasOwnProperty('chars')) { + options = length; + pattern = options.chars; + length = pattern.length; + custom = true; + } + + var opts = options || {}; + var mask = ''; + var res = ''; + + // Characters to be used + if (pattern.indexOf('?') !== -1) mask += opts.chars; + if (pattern.indexOf('a') !== -1) mask += type.lower; + if (pattern.indexOf('A') !== -1) mask += type.upper; + if (pattern.indexOf('0') !== -1) mask += type.number; + if (pattern.indexOf('!') !== -1) mask += type.special; + if (pattern.indexOf('*') !== -1) mask += type.all; + if (custom) mask += pattern; + + // Characters to exclude + if (opts.exclude) { + var exclude = typeOf(opts.exclude) === 'string' ? opts.exclude : opts.exclude.join(''); + exclude = exclude.replace(new RegExp('[\\]]+', 'g'), ''); + mask = mask.replace(new RegExp('[' + exclude + ']+', 'g'), ''); + + if(opts.exclude.indexOf(']') !== -1) mask = mask.replace(new RegExp('[\\]]+', 'g'), ''); + } + + while (length--) { + res += mask.charAt(parseInt(mathRandom() * mask.length, 10)); + } + return res; +}; diff --git a/node_modules/randomatic/node_modules/is-number/LICENSE b/node_modules/randomatic/node_modules/is-number/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/randomatic/node_modules/is-number/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/randomatic/node_modules/is-number/README.md b/node_modules/randomatic/node_modules/is-number/README.md new file mode 100644 index 00000000..6436992d --- /dev/null +++ b/node_modules/randomatic/node_modules/is-number/README.md @@ -0,0 +1,135 @@ +# is-number [![NPM version](https://img.shields.io/npm/v/is-number.svg?style=flat)](https://www.npmjs.com/package/is-number) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![NPM total downloads](https://img.shields.io/npm/dt/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-number.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-number) + +> Returns true if the value is a number. comprehensive tests. + +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 is-number +``` + +## Usage + +To understand some of the rationale behind the decisions made in this library (and to learn about some oddities of number evaluation in JavaScript), [see this gist](https://gist.github.com/jonschlinkert/e30c70c713da325d0e81). + +```js +var isNumber = require('is-number'); +``` + +### true + +See the [tests](./test.js) for more examples. + +```js +isNumber(5e3) //=> 'true' +isNumber(0xff) //=> 'true' +isNumber(-1.1) //=> 'true' +isNumber(0) //=> 'true' +isNumber(1) //=> 'true' +isNumber(1.1) //=> 'true' +isNumber(10) //=> 'true' +isNumber(10.10) //=> 'true' +isNumber(100) //=> 'true' +isNumber('-1.1') //=> 'true' +isNumber('0') //=> 'true' +isNumber('012') //=> 'true' +isNumber('0xff') //=> 'true' +isNumber('1') //=> 'true' +isNumber('1.1') //=> 'true' +isNumber('10') //=> 'true' +isNumber('10.10') //=> 'true' +isNumber('100') //=> 'true' +isNumber('5e3') //=> 'true' +isNumber(parseInt('012')) //=> 'true' +isNumber(parseFloat('012')) //=> 'true' +``` + +### False + +See the [tests](./test.js) for more examples. + +```js +isNumber('foo') //=> 'false' +isNumber([1]) //=> 'false' +isNumber([]) //=> 'false' +isNumber(function () {}) //=> 'false' +isNumber(Infinity) //=> 'false' +isNumber(NaN) //=> 'false' +isNumber(new Array('abc')) //=> 'false' +isNumber(new Array(2)) //=> 'false' +isNumber(new Buffer('abc')) //=> 'false' +isNumber(null) //=> 'false' +isNumber(undefined) //=> 'false' +isNumber({abc: 'abc'}) //=> '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: + +* [even](https://www.npmjs.com/package/even): Get the even numbered items from an array. | [homepage](https://github.com/jonschlinkert/even "Get the even numbered items from an array.") +* [is-even](https://www.npmjs.com/package/is-even): Return true if the given number is even. | [homepage](https://github.com/jonschlinkert/is-even "Return true if the given number is even.") +* [is-odd](https://www.npmjs.com/package/is-odd): Returns true if the given number is odd. | [homepage](https://github.com/jonschlinkert/is-odd "Returns true if the given number is odd.") +* [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. ") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") +* [odd](https://www.npmjs.com/package/odd): Get the odd numbered items from an array. | [homepage](https://github.com/jonschlinkert/odd "Get the odd numbered items from an array.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 38 | [jonschlinkert](https://github.com/jonschlinkert) | +| 5 | [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 17, 2017._ \ No newline at end of file diff --git a/node_modules/randomatic/node_modules/is-number/index.js b/node_modules/randomatic/node_modules/is-number/index.js new file mode 100644 index 00000000..5221f405 --- /dev/null +++ b/node_modules/randomatic/node_modules/is-number/index.js @@ -0,0 +1,21 @@ +/*! + * is-number + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function isNumber(num) { + var type = typeof num; + + if (type === 'string' || num instanceof String) { + // an empty string would be coerced to true with the below logic + if (!num.trim()) return false; + } else if (type !== 'number' && !(num instanceof Number)) { + return false; + } + + return (num - num + 1) >= 0; +}; diff --git a/node_modules/randomatic/node_modules/is-number/package.json b/node_modules/randomatic/node_modules/is-number/package.json new file mode 100644 index 00000000..4511babc --- /dev/null +++ b/node_modules/randomatic/node_modules/is-number/package.json @@ -0,0 +1,113 @@ +{ + "_from": "is-number@^4.0.0", + "_id": "is-number@4.0.0", + "_inBundle": false, + "_integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "_location": "/randomatic/is-number", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-number@^4.0.0", + "name": "is-number", + "escapedName": "is-number", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/randomatic" + ], + "_resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "_shasum": "0026e37f5454d73e356dfe6564699867c6a7f0ff", + "_spec": "is-number@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/randomatic", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-number/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "tunnckoCore", + "url": "https://i.am.charlike.online" + } + ], + "deprecated": false, + "description": "Returns true if the value is a number. comprehensive tests.", + "devDependencies": { + "benchmarked": "^2.0.0", + "chalk": "^2.1.0", + "gulp-format-md": "^1.0.0", + "mocha": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-number", + "keywords": [ + "check", + "coerce", + "coercion", + "integer", + "is", + "is-nan", + "is-num", + "is-number", + "istype", + "kind", + "math", + "nan", + "num", + "number", + "numeric", + "test", + "type", + "typeof", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-number", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-number.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "even", + "is-even", + "is-odd", + "is-primitive", + "kind-of", + "odd" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "4.0.0" +} diff --git a/node_modules/randomatic/node_modules/kind-of/CHANGELOG.md b/node_modules/randomatic/node_modules/kind-of/CHANGELOG.md new file mode 100644 index 00000000..01687d5c --- /dev/null +++ b/node_modules/randomatic/node_modules/kind-of/CHANGELOG.md @@ -0,0 +1,160 @@ +# 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.3] - 2020-01-16 + +- Merge pull request #31 for issue #30 + +## [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 \ No newline at end of file diff --git a/node_modules/randomatic/node_modules/kind-of/LICENSE b/node_modules/randomatic/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/randomatic/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/randomatic/node_modules/kind-of/README.md b/node_modules/randomatic/node_modules/kind-of/README.md new file mode 100644 index 00000000..0411dc58 --- /dev/null +++ b/node_modules/randomatic/node_modules/kind-of/README.md @@ -0,0 +1,367 @@ +# 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/micromatch/is-glob) | [homepage](https://github.com/micromatch/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 a number or string value is a finite number. Useful for regex… [more](https://github.com/jonschlinkert/is-number) | [homepage](https://github.com/jonschlinkert/is-number "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.") +* [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** | +| --- | --- | +| 102 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [doowb](https://github.com/doowb) | +| 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 | [tunnckoCore](https://github.com/tunnckoCore) | +| 1 | [xiaofen9](https://github.com/xiaofen9) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2020, [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.8.0, on January 16, 2020._ \ No newline at end of file diff --git a/node_modules/randomatic/node_modules/kind-of/index.js b/node_modules/randomatic/node_modules/kind-of/index.js new file mode 100644 index 00000000..dfa799b7 --- /dev/null +++ b/node_modules/randomatic/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 typeof val.constructor === 'function' ? 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/randomatic/node_modules/kind-of/package.json b/node_modules/randomatic/node_modules/kind-of/package.json new file mode 100644 index 00000000..a9fbd2cf --- /dev/null +++ b/node_modules/randomatic/node_modules/kind-of/package.json @@ -0,0 +1,143 @@ +{ + "_from": "kind-of@^6.0.0", + "_id": "kind-of@6.0.3", + "_inBundle": false, + "_integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "_location": "/randomatic/kind-of", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "kind-of@^6.0.0", + "name": "kind-of", + "escapedName": "kind-of", + "rawSpec": "^6.0.0", + "saveSpec": null, + "fetchSpec": "^6.0.0" + }, + "_requiredBy": [ + "/randomatic" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "_shasum": "07c05034a6c349fa06e24fa35aa76db4580ce4dd", + "_spec": "kind-of@^6.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/randomatic", + "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.3" +} diff --git a/node_modules/randomatic/package.json b/node_modules/randomatic/package.json new file mode 100644 index 00000000..e9685b1c --- /dev/null +++ b/node_modules/randomatic/package.json @@ -0,0 +1,135 @@ +{ + "_from": "randomatic@^3.0.0", + "_id": "randomatic@3.1.1", + "_inBundle": false, + "_integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", + "_location": "/randomatic", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "randomatic@^3.0.0", + "name": "randomatic", + "escapedName": "randomatic", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/fill-range" + ], + "_resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "_shasum": "b776efc59375984e36c537b2f51a1f0aff0da1ed", + "_spec": "randomatic@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/fill-range", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/randomatic/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Bogdan Chadkin", + "url": "https://github.com/TrySound" + }, + { + "name": "Dragos Fotescu", + "url": "http://dragosfotescu.com" + }, + { + "name": "Faiz ul haque", + "url": "http://www.10pearls.com" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Michael Rhodes", + "url": "http://michaelrhod.es" + }, + { + "name": "Paul Miller", + "url": "https://paulmillr.com" + }, + { + "name": "Rouven Weßling", + "url": "www.rouvenwessling.de" + }, + { + "name": "Sun Knudsen", + "url": "https://sunknudsen.com" + } + ], + "dependencies": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "deprecated": false, + "description": "Generate randomized strings of a specified length using simple character sequences. The original generate-password.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.1.1", + "glob": "^7.1.2", + "gulp-format-md": "^0.1.12", + "mocha": "^3.4.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/randomatic", + "keywords": [ + "alpha", + "alpha-numeric", + "alphanumeric", + "characters", + "chars", + "generate", + "generate-password", + "numeric", + "password", + "rand", + "random", + "randomatic", + "randomize", + "randomized" + ], + "license": "MIT", + "main": "index.js", + "name": "randomatic", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/randomatic.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "pad-left", + "pad-right", + "repeat-string" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "3.1.1" +} diff --git a/node_modules/rc/LICENSE.APACHE2 b/node_modules/rc/LICENSE.APACHE2 new file mode 100644 index 00000000..6366c047 --- /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 00000000..96bb796a --- /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 00000000..6eafbd73 --- /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 00000000..e6522e26 --- /dev/null +++ b/node_modules/rc/README.md @@ -0,0 +1,227 @@ +# 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. + +To ensure that string representations of booleans and numbers are always converted into their proper types (especially useful if you intend to do strict `===` comparisons), consider using a module such as [parse-strings-in-object](https://github.com/anselanza/parse-strings-in-object) to wrap the config object returned from rc. + + +## 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 00000000..8c230c5c --- /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 00000000..ab05b607 --- /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 00000000..65eb47af --- /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 00000000..8b3beffa --- /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 00000000..86a3f567 --- /dev/null +++ b/node_modules/rc/package.json @@ -0,0 +1,64 @@ +{ + "_from": "rc@^1.1.0", + "_id": "rc@1.2.8", + "_inBundle": false, + "_integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "_location": "/rc", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "rc@^1.1.0", + "name": "rc", + "escapedName": "rc", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/npm-prefix" + ], + "_resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "_shasum": "cd924bf5200a075b83c188cd6b9e211b7fc0d3ed", + "_spec": "rc@^1.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/npm-prefix", + "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.6.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.8" +} diff --git a/node_modules/rc/test/ini.js b/node_modules/rc/test/ini.js new file mode 100644 index 00000000..e6857f8b --- /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 00000000..0ecd1763 --- /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 00000000..4f633518 --- /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 00000000..f62cdac0 --- /dev/null +++ b/node_modules/readable-stream/.travis.yml @@ -0,0 +1,34 @@ +sudo: false +language: node_js +before_install: + - (test $NPM_LEGACY && npm install -g npm@2 && npm install -g npm@3) || true +notifications: + email: false +matrix: + fast_finish: true + include: + - node_js: '0.8' + env: NPM_LEGACY=true + - node_js: '0.10' + env: NPM_LEGACY=true + - node_js: '0.11' + env: NPM_LEGACY=true + - node_js: '0.12' + env: NPM_LEGACY=true + - node_js: 1 + env: NPM_LEGACY=true + - node_js: 2 + env: NPM_LEGACY=true + - node_js: 3 + env: NPM_LEGACY=true + - node_js: 4 + - node_js: 5 + - node_js: 6 + - node_js: 7 + - node_js: 8 + - node_js: 9 +script: "npm run test" +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 00000000..f478d58d --- /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 00000000..16ffb93f --- /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 00000000..2873b3b2 --- /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 00000000..23fe3f3e --- /dev/null +++ b/node_modules/readable-stream/README.md @@ -0,0 +1,58 @@ +# readable-stream + +***Node-core v8.11.1 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.11.1/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 00000000..83275f19 --- /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 00000000..f8b2db83 --- /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 00000000..46924cbf --- /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 00000000..57003c32 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,131 @@ +// 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 = Object.create(require('core-util-is')); +util.inherits = require('inherits'); +/**/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +{ + // avoid scope creep, the keys array can then be collected + 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); +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// 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); +}; \ 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 00000000..612edb4d --- /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 = Object.create(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 00000000..0f807646 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,1019 @@ +// 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 = Object.create(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; +}; + +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._readableState.highWaterMark; + } +}); + +// 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 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 00000000..fcfc105a --- /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 = Object.create(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 00000000..b0b02200 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,687 @@ +// 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 = Object.create(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; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// 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 00000000..aefc68bd --- /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 00000000..5a0a0d88 --- /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 00000000..9332a3fd --- /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 00000000..ce2ad5b6 --- /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 00000000..f8b89590 --- /dev/null +++ b/node_modules/readable-stream/package.json @@ -0,0 +1,82 @@ +{ + "_from": "readable-stream@^2.0.2", + "_id": "readable-stream@2.3.7", + "_inBundle": false, + "_integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "_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": [ + "/concat-stream", + "/readdirp" + ], + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "_shasum": "1eca1cf711aef814c04f62252a36a62f6cb23b57", + "_spec": "readable-stream@^2.0.2", + "_where": "/home/remi/github/CPP_BIDS/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.1.1", + "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" + }, + "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": { + "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js", + "cover": "nyc npm test", + "report": "nyc report --reporter=lcov", + "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js" + }, + "version": "2.3.7" +} diff --git a/node_modules/readable-stream/passthrough.js b/node_modules/readable-stream/passthrough.js new file mode 100644 index 00000000..ffd791d7 --- /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 00000000..e5037259 --- /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 00000000..ec89ec53 --- /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 00000000..b1baba26 --- /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 00000000..ebdde6a8 --- /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 00000000..3211a6f8 --- /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/LICENSE b/node_modules/readdirp/LICENSE new file mode 100644 index 00000000..8a63b80b --- /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 00000000..431f4025 --- /dev/null +++ b/node_modules/readdirp/README.md @@ -0,0 +1,204 @@ +# readdirp [![Build Status](https://secure.travis-ci.org/thlorenz/readdirp.svg)](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 specifying 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/paulmillr/readdirp/blob/master/examples/Readme.md) +on how to get going. + +## tests + +The [readdirp tests](https://github.com/paulmillr/readdirp/blob/master/test/readdirp.js) also will give you a good idea on +how things work. + diff --git a/node_modules/readdirp/node_modules/arr-diff/LICENSE b/node_modules/readdirp/node_modules/arr-diff/LICENSE new file mode 100755 index 00000000..d734237b --- /dev/null +++ b/node_modules/readdirp/node_modules/arr-diff/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/readdirp/node_modules/arr-diff/README.md b/node_modules/readdirp/node_modules/arr-diff/README.md new file mode 100644 index 00000000..961f5c3f --- /dev/null +++ b/node_modules/readdirp/node_modules/arr-diff/README.md @@ -0,0 +1,130 @@ +# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg?style=flat)](https://www.npmjs.com/package/arr-diff) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-diff.svg?style=flat)](https://npmjs.org/package/arr-diff) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-diff.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-diff) + +> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save arr-diff +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add arr-diff +``` + +Install with [bower](https://bower.io/) + +```sh +$ bower install arr-diff --save +``` + +## Usage + +Returns the difference between the first array and additional arrays. + +```js +var diff = require('arr-diff'); + +var a = ['a', 'b', 'c', 'd']; +var b = ['b', 'c']; + +console.log(diff(a, b)) +//=> ['a', 'd'] +``` + +## Benchmarks + +This library versus [array-differ](https://github.com/sindresorhus/array-differ), on April 14, 2017: + +``` +Benchmarking: (4 of 4) + · long-dupes + · long + · med + · short + +# benchmark/fixtures/long-dupes.js (100804 bytes) + arr-diff-3.0.0 x 822 ops/sec ±0.67% (86 runs sampled) + arr-diff-4.0.0 x 2,141 ops/sec ±0.42% (89 runs sampled) + array-differ x 708 ops/sec ±0.70% (89 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/long.js (94529 bytes) + arr-diff-3.0.0 x 882 ops/sec ±0.60% (87 runs sampled) + arr-diff-4.0.0 x 2,329 ops/sec ±0.97% (83 runs sampled) + array-differ x 769 ops/sec ±0.61% (90 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/med.js (708 bytes) + arr-diff-3.0.0 x 856,150 ops/sec ±0.42% (89 runs sampled) + arr-diff-4.0.0 x 4,665,249 ops/sec ±1.06% (89 runs sampled) + array-differ x 653,888 ops/sec ±1.02% (86 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/short.js (60 bytes) + arr-diff-3.0.0 x 3,078,467 ops/sec ±0.77% (93 runs sampled) + arr-diff-4.0.0 x 9,213,296 ops/sec ±0.65% (89 runs sampled) + array-differ x 1,337,051 ops/sec ±0.91% (92 runs sampled) + + fastest is arr-diff-4.0.0 +``` + +## About + +### Related projects + +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") +* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter "Array#filter for older browsers.") +* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://github.com/jonschlinkert/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection "Return an array with the unique values present in _all_ given arrays using strict equality for comparisons.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 33 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [paulmillr](https://github.com/paulmillr) | + +### 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 14, 2017._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/arr-diff/index.js b/node_modules/readdirp/node_modules/arr-diff/index.js new file mode 100644 index 00000000..90f28077 --- /dev/null +++ b/node_modules/readdirp/node_modules/arr-diff/index.js @@ -0,0 +1,47 @@ +/*! + * arr-diff + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function diff(arr/*, arrays*/) { + var len = arguments.length; + var idx = 0; + while (++idx < len) { + arr = diffArray(arr, arguments[idx]); + } + return arr; +}; + +function diffArray(one, two) { + if (!Array.isArray(two)) { + return one.slice(); + } + + var tlen = two.length + var olen = one.length; + var idx = -1; + var arr = []; + + while (++idx < olen) { + var ele = one[idx]; + + var hasEle = false; + for (var i = 0; i < tlen; i++) { + var val = two[i]; + + if (ele === val) { + hasEle = true; + break; + } + } + + if (hasEle === false) { + arr.push(ele); + } + } + return arr; +} diff --git a/node_modules/readdirp/node_modules/arr-diff/package.json b/node_modules/readdirp/node_modules/arr-diff/package.json new file mode 100644 index 00000000..79d8062d --- /dev/null +++ b/node_modules/readdirp/node_modules/arr-diff/package.json @@ -0,0 +1,108 @@ +{ + "_from": "arr-diff@^4.0.0", + "_id": "arr-diff@4.0.0", + "_inBundle": false, + "_integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "_location": "/readdirp/arr-diff", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "arr-diff@^4.0.0", + "name": "arr-diff", + "escapedName": "arr-diff", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "_shasum": "d6461074febfec71e7e15235761a329a5dc7c520", + "_spec": "arr-diff@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/arr-diff/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Paul Miller", + "email": "paul+gh@paulmillr.com", + "url": "paulmillr.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "arr-flatten": "^1.0.1", + "array-differ": "^1.0.0", + "benchmarked": "^0.2.4", + "gulp-format-md": "^0.1.9", + "minimist": "^1.2.0", + "mocha": "^2.4.5" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/arr-diff", + "keywords": [ + "arr", + "array", + "array differ", + "array-differ", + "diff", + "differ", + "difference" + ], + "license": "MIT", + "main": "index.js", + "name": "arr-diff", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/arr-diff.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-flatten", + "array-filter", + "array-intersection" + ] + }, + "reflinks": [ + "array-differ", + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "4.0.0" +} diff --git a/node_modules/readdirp/node_modules/array-unique/LICENSE b/node_modules/readdirp/node_modules/array-unique/LICENSE new file mode 100755 index 00000000..842218cf --- /dev/null +++ b/node_modules/readdirp/node_modules/array-unique/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/readdirp/node_modules/array-unique/README.md b/node_modules/readdirp/node_modules/array-unique/README.md new file mode 100755 index 00000000..41c8c904 --- /dev/null +++ b/node_modules/readdirp/node_modules/array-unique/README.md @@ -0,0 +1,77 @@ +# array-unique [![NPM version](https://img.shields.io/npm/v/array-unique.svg?style=flat)](https://www.npmjs.com/package/array-unique) [![NPM downloads](https://img.shields.io/npm/dm/array-unique.svg?style=flat)](https://npmjs.org/package/array-unique) [![Build Status](https://img.shields.io/travis/jonschlinkert/array-unique.svg?style=flat)](https://travis-ci.org/jonschlinkert/array-unique) + +Remove duplicate values from an array. Fastest ES5 implementation. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save array-unique +``` + +## Usage + +```js +var unique = require('array-unique'); + +var arr = ['a', 'b', 'c', 'c']; +console.log(unique(arr)) //=> ['a', 'b', 'c'] +console.log(arr) //=> ['a', 'b', 'c'] + +/* The above modifies the input array. To prevent that at a slight performance cost: */ +var unique = require("array-unique").immutable; + +var arr = ['a', 'b', 'c', 'c']; +console.log(unique(arr)) //=> ['a', 'b', 'c'] +console.log(arr) //=> ['a', 'b', 'c', 'c'] +``` + +## About + +### Related projects + +* [arr-diff](https://www.npmjs.com/package/arr-diff): Returns an array with only the unique values from the first array, by excluding all… [more](https://github.com/jonschlinkert/arr-diff) | [homepage](https://github.com/jonschlinkert/arr-diff "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.") +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") +* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map "Faster, node.js focused alternative to JavaScript's native array map.") +* [arr-pluck](https://www.npmjs.com/package/arr-pluck): Retrieves the value of a specified property from all elements in the collection. | [homepage](https://github.com/jonschlinkert/arr-pluck "Retrieves the value of a specified property from all elements in the collection.") +* [arr-reduce](https://www.npmjs.com/package/arr-reduce): Fast array reduce that also loops over sparse elements. | [homepage](https://github.com/jonschlinkert/arr-reduce "Fast array reduce that also loops over sparse elements.") +* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.") + +### 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/array-unique/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.28, on July 31, 2016._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/array-unique/index.js b/node_modules/readdirp/node_modules/array-unique/index.js new file mode 100644 index 00000000..7e481e07 --- /dev/null +++ b/node_modules/readdirp/node_modules/array-unique/index.js @@ -0,0 +1,43 @@ +/*! + * array-unique + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +module.exports = function unique(arr) { + if (!Array.isArray(arr)) { + throw new TypeError('array-unique expects an array.'); + } + + var len = arr.length; + var i = -1; + + while (i++ < len) { + var j = i + 1; + + for (; j < arr.length; ++j) { + if (arr[i] === arr[j]) { + arr.splice(j--, 1); + } + } + } + return arr; +}; + +module.exports.immutable = function uniqueImmutable(arr) { + if (!Array.isArray(arr)) { + throw new TypeError('array-unique expects an array.'); + } + + var arrLen = arr.length; + var newArr = new Array(arrLen); + + for (var i = 0; i < arrLen; i++) { + newArr[i] = arr[i]; + } + + return module.exports(newArr); +}; diff --git a/node_modules/readdirp/node_modules/array-unique/package.json b/node_modules/readdirp/node_modules/array-unique/package.json new file mode 100644 index 00000000..18fd23f6 --- /dev/null +++ b/node_modules/readdirp/node_modules/array-unique/package.json @@ -0,0 +1,95 @@ +{ + "_from": "array-unique@^0.3.2", + "_id": "array-unique@0.3.2", + "_inBundle": false, + "_integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "_location": "/readdirp/array-unique", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "array-unique@^0.3.2", + "name": "array-unique", + "escapedName": "array-unique", + "rawSpec": "^0.3.2", + "saveSpec": null, + "fetchSpec": "^0.3.2" + }, + "_requiredBy": [ + "/readdirp/braces", + "/readdirp/extglob", + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "_shasum": "a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428", + "_spec": "array-unique@^0.3.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/array-unique/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Remove duplicate values from an array. Fastest ES5 implementation.", + "devDependencies": { + "array-uniq": "^1.0.2", + "benchmarked": "^0.1.3", + "gulp-format-md": "^0.1.9", + "mocha": "^2.5.3", + "should": "^10.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/jonschlinkert/array-unique", + "keywords": [ + "array", + "unique" + ], + "license": "MIT", + "main": "index.js", + "name": "array-unique", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/array-unique.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-diff", + "arr-union", + "arr-flatten", + "arr-reduce", + "arr-map", + "arr-pluck" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.3.2" +} diff --git a/node_modules/readdirp/node_modules/braces/LICENSE b/node_modules/readdirp/node_modules/braces/LICENSE new file mode 100644 index 00000000..d32ab442 --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/braces/README.md b/node_modules/readdirp/node_modules/braces/README.md new file mode 100644 index 00000000..f909bfba --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/braces/index.js b/node_modules/readdirp/node_modules/braces/index.js new file mode 100644 index 00000000..048e1c23 --- /dev/null +++ b/node_modules/readdirp/node_modules/braces/index.js @@ -0,0 +1,318 @@ +'use strict'; + +/** + * Module dependencies + */ + +var toRegex = require('to-regex'); +var unique = require('array-unique'); +var extend = require('extend-shallow'); + +/** + * 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); + } + + Object.defineProperty(arr, 'result', { + enumerable: false, + value: 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/readdirp/node_modules/braces/lib/braces.js b/node_modules/readdirp/node_modules/braces/lib/braces.js new file mode 100644 index 00000000..baf6bf1b --- /dev/null +++ b/node_modules/readdirp/node_modules/braces/lib/braces.js @@ -0,0 +1,104 @@ +'use strict'; + +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. + */ + + utils.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) { + utils.define(node, 'parent', parent); + parent.nodes.push(node); + } + + // add non-enumerable parser reference + utils.define(parsed, 'parser', this.parser); + return parsed; + }); +}; + +/** + * Decorate `.parse` method + */ + +Braces.prototype.parse = function(ast, options) { + if (ast && 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/readdirp/node_modules/braces/lib/compilers.js b/node_modules/readdirp/node_modules/braces/lib/compilers.js new file mode 100644 index 00000000..a3b820e4 --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/braces/lib/parsers.js b/node_modules/readdirp/node_modules/braces/lib/parsers.js new file mode 100644 index 00000000..8bf3e92b --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/braces/lib/utils.js b/node_modules/readdirp/node_modules/braces/lib/utils.js new file mode 100644 index 00000000..47166717 --- /dev/null +++ b/node_modules/readdirp/node_modules/braces/lib/utils.js @@ -0,0 +1,343 @@ +'use strict'; + +var splitString = require('split-string'); +var utils = module.exports; + +/** + * Module dependencies + */ + +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'); + +utils.define = function(obj, key, val) { + Object.defineProperty(obj, key, { + writable: true, + configurable: true, + enumerable: false, + value: val + }); +}; + +/** + * 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/readdirp/node_modules/braces/node_modules/extend-shallow/LICENSE b/node_modules/readdirp/node_modules/braces/node_modules/extend-shallow/LICENSE new file mode 100644 index 00000000..fa30c4cb --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/braces/node_modules/extend-shallow/README.md b/node_modules/readdirp/node_modules/braces/node_modules/extend-shallow/README.md new file mode 100644 index 00000000..cdc45d4f --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/braces/node_modules/extend-shallow/index.js b/node_modules/readdirp/node_modules/braces/node_modules/extend-shallow/index.js new file mode 100644 index 00000000..92a067fc --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/braces/node_modules/extend-shallow/package.json b/node_modules/readdirp/node_modules/braces/node_modules/extend-shallow/package.json new file mode 100644 index 00000000..b289adeb --- /dev/null +++ b/node_modules/readdirp/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": "/readdirp/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": [ + "/readdirp/braces" + ], + "_resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "_shasum": "51af7d614ad9a9f610ea1bafbb989d6b1c56890f", + "_spec": "extend-shallow@^2.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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/readdirp/node_modules/braces/package.json b/node_modules/readdirp/node_modules/braces/package.json new file mode 100644 index 00000000..623397ef --- /dev/null +++ b/node_modules/readdirp/node_modules/braces/package.json @@ -0,0 +1,156 @@ +{ + "_from": "braces@^2.3.1", + "_id": "braces@2.3.2", + "_inBundle": false, + "_integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "_location": "/readdirp/braces", + "_phantomChildren": { + "is-extendable": "0.1.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "braces@^2.3.1", + "name": "braces", + "escapedName": "braces", + "rawSpec": "^2.3.1", + "saveSpec": null, + "fetchSpec": "^2.3.1" + }, + "_requiredBy": [ + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "_shasum": "5979fd3f14cd531565e5fa2df1abfff1dfaee729", + "_spec": "braces@^2.3.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/micromatch", + "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", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "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.2" +} diff --git a/node_modules/readdirp/node_modules/expand-brackets/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/LICENSE new file mode 100644 index 00000000..65251717 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/README.md b/node_modules/readdirp/node_modules/expand-brackets/README.md new file mode 100644 index 00000000..c0e33d08 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/README.md @@ -0,0 +1,302 @@ +# expand-brackets [![NPM version](https://img.shields.io/npm/v/expand-brackets.svg?style=flat)](https://www.npmjs.com/package/expand-brackets) [![NPM monthly downloads](https://img.shields.io/npm/dm/expand-brackets.svg?style=flat)](https://npmjs.org/package/expand-brackets) [![NPM total downloads](https://img.shields.io/npm/dt/expand-brackets.svg?style=flat)](https://npmjs.org/package/expand-brackets) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/expand-brackets.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/expand-brackets) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/expand-brackets.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/expand-brackets) + +> Expand POSIX bracket expressions (character classes) in glob patterns. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save expand-brackets +``` + +## Usage + +```js +var brackets = require('expand-brackets'); +brackets(string[, options]); +``` + +**Params** + +The main export is a function that takes the following parameters: + +* `pattern` **{String}**: the pattern to convert +* `options` **{Object}**: optionally supply an options object +* `returns` **{String}**: returns a string that can be used to create a regex + +**Example** + +```js +console.log(brackets('[![:lower:]]')); +//=> '[^a-z]' +``` + +## API + +### [brackets](index.js#L29) + +Parses the given POSIX character class `pattern` and returns a +string that can be used for creating regular expressions for matching. + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{Object}** + +### [.match](index.js#L54) + +Takes an array of strings and a POSIX character class pattern, and returns a new array with only the strings that matched the pattern. + +**Example** + +```js +var brackets = require('expand-brackets'); +console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]')); +//=> ['a'] + +console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]+')); +//=> ['a', 'ab'] +``` + +**Params** + +* `arr` **{Array}**: Array of strings to match +* `pattern` **{String}**: POSIX character class pattern(s) +* `options` **{Object}** +* `returns` **{Array}** + +### [.isMatch](index.js#L100) + +Returns true if the specified `string` matches the given brackets `pattern`. + +**Example** + +```js +var brackets = require('expand-brackets'); + +console.log(brackets.isMatch('a.a', '[[:alpha:]].[[:alpha:]]')); +//=> true +console.log(brackets.isMatch('1.2', '[[:alpha:]].[[:alpha:]]')); +//=> false +``` + +**Params** + +* `string` **{String}**: String to match +* `pattern` **{String}**: Poxis pattern +* `options` **{String}** +* `returns` **{Boolean}** + +### [.matcher](index.js#L123) + +Takes a POSIX character class pattern and returns a matcher function. The returned function takes the string to match as its only argument. + +**Example** + +```js +var brackets = require('expand-brackets'); +var isMatch = brackets.matcher('[[:lower:]].[[:upper:]]'); + +console.log(isMatch('a.a')); +//=> false +console.log(isMatch('a.A')); +//=> true +``` + +**Params** + +* `pattern` **{String}**: Poxis pattern +* `options` **{String}** +* `returns` **{Boolean}** + +### [.makeRe](index.js#L145) + +Create a regular expression from the given `pattern`. + +**Example** + +```js +var brackets = require('expand-brackets'); +var re = brackets.makeRe('[[:alpha:]]'); +console.log(re); +//=> /^(?:[a-zA-Z])$/ +``` + +**Params** + +* `pattern` **{String}**: The pattern to convert to regex. +* `options` **{Object}** +* `returns` **{RegExp}** + +### [.create](index.js#L187) + +Parses the given POSIX character class `pattern` and returns an object with the compiled `output` and optional source `map`. + +**Example** + +```js +var brackets = require('expand-brackets'); +console.log(brackets('[[:alpha:]]')); +// { options: { source: 'string' }, +// input: '[[:alpha:]]', +// state: {}, +// compilers: +// { eos: [Function], +// noop: [Function], +// bos: [Function], +// not: [Function], +// escape: [Function], +// text: [Function], +// posix: [Function], +// bracket: [Function], +// 'bracket.open': [Function], +// 'bracket.inner': [Function], +// 'bracket.literal': [Function], +// 'bracket.close': [Function] }, +// output: '[a-zA-Z]', +// ast: +// { type: 'root', +// errors: [], +// nodes: [ [Object], [Object], [Object] ] }, +// parsingErrors: [] } +``` + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{Object}** + +## Options + +### options.sourcemap + +Generate a source map for the given pattern. + +**Example** + +```js +var res = brackets('[:alpha:]', {sourcemap: true}); + +console.log(res.map); +// { version: 3, +// sources: [ 'brackets' ], +// names: [], +// mappings: 'AAAA,MAAS', +// sourcesContent: [ '[:alpha:]' ] } +``` + +### POSIX Character classes + +The following named POSIX bracket expressions are supported: + +* `[:alnum:]`: Alphanumeric characters (`a-zA-Z0-9]`) +* `[:alpha:]`: Alphabetic characters (`a-zA-Z]`) +* `[:blank:]`: Space and tab (`[ t]`) +* `[:digit:]`: Digits (`[0-9]`) +* `[:lower:]`: Lowercase letters (`[a-z]`) +* `[:punct:]`: Punctuation and symbols. (`[!"#$%&'()*+, -./:;<=>?@ [\]^_``{|}~]`) +* `[:upper:]`: Uppercase letters (`[A-Z]`) +* `[:word:]`: Word characters (letters, numbers and underscores) (`[A-Za-z0-9_]`) +* `[:xdigit:]`: Hexadecimal digits (`[A-Fa-f0-9]`) + +See [posix-character-classes](https://github.com/jonschlinkert/posix-character-classes) for more details. + +**Not supported** + +* [equivalence classes](https://www.gnu.org/software/gawk/manual/html_node/Bracket-Expressions.html) are not supported +* [POSIX.2 collating symbols](https://www.gnu.org/software/gawk/manual/html_node/Bracket-Expressions.html) are not supported + +## Changelog + +### v2.0.0 + +**Breaking changes** + +* The main export now returns the compiled string, instead of the object returned from the compiler + +**Added features** + +* Adds a `.create` method to do what the main function did before v2.0.0 + +### v0.2.0 + +In addition to performance and matching improvements, the v0.2.0 refactor adds complete POSIX character class support, with the exception of equivalence classes and POSIX.2 collating symbols which are not relevant to node.js usage. + +**Added features** + +* parser is exposed, so that expand-brackets parsers can be used by upstream parsers (like [micromatch](https://github.com/jonschlinkert/micromatch)) +* compiler is exposed, so that expand-brackets compilers can be used by upstream compilers +* source maps + +**source map example** + +```js +var brackets = require('expand-brackets'); +var res = brackets('[:alpha:]'); +console.log(res.map); + +{ version: 3, + sources: [ 'brackets' ], + names: [], + mappings: 'AAAA,MAAS', + sourcesContent: [ '[:alpha:]' ] } +``` + +## About + +### Related projects + +* [braces](https://www.npmjs.com/package/braces): Fast, comprehensive, bash-like brace expansion implemented in JavaScript. Complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fast, comprehensive, bash-like brace expansion implemented in JavaScript. Complete support for the Bash 4.3 braces specification, without sacrificing speed.") +* [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/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Extended glob support for JavaScript. Adds (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.") +* [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/jonschlinkert/nanomatch) | [homepage](https://github.com/jonschlinkert/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)") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor**
| +| --- | --- | +| 66 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [MartinKolarik](https://github.com/MartinKolarik) | +| 2 | [es128](https://github.com/es128) | +| 1 | [eush77](https://github.com/eush77) | + +### 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/expand-brackets/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on December 12, 2016._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/expand-brackets/changelog.md b/node_modules/readdirp/node_modules/expand-brackets/changelog.md new file mode 100644 index 00000000..0c0723ab --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/changelog.md @@ -0,0 +1,35 @@ +## Changelog + +### v2.0.0 + +**Breaking changes** + +- The main export now returns the compiled string, instead of the object returned from the compiler + +**Added features** + +- Adds a `.create` method to do what the main function did before v2.0.0 + +### v0.2.0 + +In addition to performance and matching improvements, the v0.2.0 refactor adds complete POSIX character class support, with the exception of equivalence classes and POSIX.2 collating symbols which are not relevant to node.js usage. + +**Added features** + +- parser is exposed, so that expand-brackets parsers can be used by upstream parsers (like [micromatch][]) +- compiler is exposed, so that expand-brackets compilers can be used by upstream compilers +- source maps + +**source map example** + +```js +var brackets = require('expand-brackets'); +var res = brackets('[:alpha:]'); +console.log(res.map); + +{ version: 3, + sources: [ 'brackets' ], + names: [], + mappings: 'AAAA,MAAS', + sourcesContent: [ '[:alpha:]' ] } +``` diff --git a/node_modules/readdirp/node_modules/expand-brackets/index.js b/node_modules/readdirp/node_modules/expand-brackets/index.js new file mode 100644 index 00000000..74b8b155 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/index.js @@ -0,0 +1,211 @@ +'use strict'; + +/** + * Local dependencies + */ + +var compilers = require('./lib/compilers'); +var parsers = require('./lib/parsers'); + +/** + * Module dependencies + */ + +var debug = require('debug')('expand-brackets'); +var extend = require('extend-shallow'); +var Snapdragon = require('snapdragon'); +var toRegex = require('to-regex'); + +/** + * Parses the given POSIX character class `pattern` and returns a + * string that can be used for creating regular expressions for matching. + * + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} + * @api public + */ + +function brackets(pattern, options) { + debug('initializing from <%s>', __filename); + var res = brackets.create(pattern, options); + return res.output; +} + +/** + * Takes an array of strings and a POSIX character class pattern, and returns a new + * array with only the strings that matched the pattern. + * + * ```js + * var brackets = require('expand-brackets'); + * console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]')); + * //=> ['a'] + * + * console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]+')); + * //=> ['a', 'ab'] + * ``` + * @param {Array} `arr` Array of strings to match + * @param {String} `pattern` POSIX character class pattern(s) + * @param {Object} `options` + * @return {Array} + * @api public + */ + +brackets.match = function(arr, pattern, options) { + arr = [].concat(arr); + var opts = extend({}, options); + var isMatch = brackets.matcher(pattern, opts); + var len = arr.length; + var idx = -1; + var res = []; + + while (++idx < len) { + var ele = arr[idx]; + if (isMatch(ele)) { + res.push(ele); + } + } + + if (res.length === 0) { + if (opts.failglob === true) { + throw new Error('no matches found for "' + pattern + '"'); + } + + if (opts.nonull === true || opts.nullglob === true) { + return [pattern.split('\\').join('')]; + } + } + return res; +}; + +/** + * Returns true if the specified `string` matches the given + * brackets `pattern`. + * + * ```js + * var brackets = require('expand-brackets'); + * + * console.log(brackets.isMatch('a.a', '[[:alpha:]].[[:alpha:]]')); + * //=> true + * console.log(brackets.isMatch('1.2', '[[:alpha:]].[[:alpha:]]')); + * //=> false + * ``` + * @param {String} `string` String to match + * @param {String} `pattern` Poxis pattern + * @param {String} `options` + * @return {Boolean} + * @api public + */ + +brackets.isMatch = function(str, pattern, options) { + return brackets.matcher(pattern, options)(str); +}; + +/** + * Takes a POSIX character class pattern and returns a matcher function. The returned + * function takes the string to match as its only argument. + * + * ```js + * var brackets = require('expand-brackets'); + * var isMatch = brackets.matcher('[[:lower:]].[[:upper:]]'); + * + * console.log(isMatch('a.a')); + * //=> false + * console.log(isMatch('a.A')); + * //=> true + * ``` + * @param {String} `pattern` Poxis pattern + * @param {String} `options` + * @return {Boolean} + * @api public + */ + +brackets.matcher = function(pattern, options) { + var re = brackets.makeRe(pattern, options); + return function(str) { + return re.test(str); + }; +}; + +/** + * Create a regular expression from the given `pattern`. + * + * ```js + * var brackets = require('expand-brackets'); + * var re = brackets.makeRe('[[:alpha:]]'); + * console.log(re); + * //=> /^(?:[a-zA-Z])$/ + * ``` + * @param {String} `pattern` The pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +brackets.makeRe = function(pattern, options) { + var res = brackets.create(pattern, options); + var opts = extend({strictErrors: false}, options); + return toRegex(res.output, opts); +}; + +/** + * Parses the given POSIX character class `pattern` and returns an object + * with the compiled `output` and optional source `map`. + * + * ```js + * var brackets = require('expand-brackets'); + * console.log(brackets('[[:alpha:]]')); + * // { options: { source: 'string' }, + * // input: '[[:alpha:]]', + * // state: {}, + * // compilers: + * // { eos: [Function], + * // noop: [Function], + * // bos: [Function], + * // not: [Function], + * // escape: [Function], + * // text: [Function], + * // posix: [Function], + * // bracket: [Function], + * // 'bracket.open': [Function], + * // 'bracket.inner': [Function], + * // 'bracket.literal': [Function], + * // 'bracket.close': [Function] }, + * // output: '[a-zA-Z]', + * // ast: + * // { type: 'root', + * // errors: [], + * // nodes: [ [Object], [Object], [Object] ] }, + * // parsingErrors: [] } + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} + * @api public + */ + +brackets.create = function(pattern, options) { + var snapdragon = (options && options.snapdragon) || new Snapdragon(options); + compilers(snapdragon); + parsers(snapdragon); + + var ast = snapdragon.parse(pattern, options); + ast.input = pattern; + var res = snapdragon.compile(ast, options); + res.input = pattern; + return res; +}; + +/** + * Expose `brackets` constructor, parsers and compilers + */ + +brackets.compilers = compilers; +brackets.parsers = parsers; + +/** + * Expose `brackets` + * @type {Function} + */ + +module.exports = brackets; diff --git a/node_modules/readdirp/node_modules/expand-brackets/lib/compilers.js b/node_modules/readdirp/node_modules/expand-brackets/lib/compilers.js new file mode 100644 index 00000000..fbf7fe81 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/lib/compilers.js @@ -0,0 +1,87 @@ +'use strict'; + +var posix = require('posix-character-classes'); + +module.exports = function(brackets) { + brackets.compiler + + /** + * Escaped characters + */ + + .set('escape', function(node) { + return this.emit('\\' + node.val.replace(/^\\/, ''), node); + }) + + /** + * Text + */ + + .set('text', function(node) { + return this.emit(node.val.replace(/([{}])/g, '\\$1'), node); + }) + + /** + * POSIX character classes + */ + + .set('posix', function(node) { + if (node.val === '[::]') { + return this.emit('\\[::\\]', node); + } + + var val = posix[node.inner]; + if (typeof val === 'undefined') { + val = '[' + node.inner + ']'; + } + return this.emit(val, node); + }) + + /** + * Non-posix brackets + */ + + .set('bracket', function(node) { + return this.mapVisit(node.nodes); + }) + .set('bracket.open', function(node) { + return this.emit(node.val, node); + }) + .set('bracket.inner', function(node) { + var inner = node.val; + + if (inner === '[' || inner === ']') { + return this.emit('\\' + node.val, node); + } + if (inner === '^]') { + return this.emit('^\\]', node); + } + if (inner === '^') { + return this.emit('^', node); + } + + if (/-/.test(inner) && !/(\d-\d|\w-\w)/.test(inner)) { + inner = inner.split('-').join('\\-'); + } + + var isNegated = inner.charAt(0) === '^'; + // add slashes to negated brackets, per spec + if (isNegated && inner.indexOf('/') === -1) { + inner += '/'; + } + if (isNegated && inner.indexOf('.') === -1) { + inner += '.'; + } + + // don't unescape `0` (octal literal) + inner = inner.replace(/\\([1-9])/g, '$1'); + return this.emit(inner, node); + }) + .set('bracket.close', function(node) { + var val = node.val.replace(/^\\/, ''); + if (node.parent.escaped === true) { + return this.emit('\\' + val, node); + } + return this.emit(val, node); + }); +}; diff --git a/node_modules/readdirp/node_modules/expand-brackets/lib/parsers.js b/node_modules/readdirp/node_modules/expand-brackets/lib/parsers.js new file mode 100644 index 00000000..450a512e --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/lib/parsers.js @@ -0,0 +1,219 @@ +'use strict'; + +var utils = require('./utils'); +var define = require('define-property'); + +/** + * Text regex + */ + +var TEXT_REGEX = '(\\[(?=.*\\])|\\])+'; +var not = utils.createRegex(TEXT_REGEX); + +/** + * Brackets parsers + */ + +function parsers(brackets) { + brackets.state = brackets.state || {}; + brackets.parser.sets.bracket = brackets.parser.sets.bracket || []; + brackets.parser + + .capture('escape', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(/^\\(.)/); + if (!m) return; + + return pos({ + type: 'escape', + val: m[0] + }); + }) + + /** + * Text parser + */ + + .capture('text', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(not); + if (!m || !m[0]) return; + + return pos({ + type: 'text', + val: m[0] + }); + }) + + /** + * POSIX character classes: "[[:alpha:][:digits:]]" + */ + + .capture('posix', function() { + var pos = this.position(); + var m = this.match(/^\[:(.*?):\](?=.*\])/); + if (!m) return; + + var inside = this.isInside('bracket'); + if (inside) { + brackets.posix++; + } + + return pos({ + type: 'posix', + insideBracket: inside, + inner: m[1], + val: m[0] + }); + }) + + /** + * Bracket (noop) + */ + + .capture('bracket', function() {}) + + /** + * Open: '[' + */ + + .capture('bracket.open', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\[(?=.*\])/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) { + last.val = last.val.slice(0, last.val.length - 1); + return pos({ + type: 'escape', + val: m[0] + }); + } + + var open = pos({ + type: 'bracket.open', + val: m[0] + }); + + if (last.type === 'bracket.open' || this.isInside('bracket')) { + open.val = '\\' + open.val; + open.type = 'bracket.inner'; + open.escaped = true; + return open; + } + + var node = pos({ + type: 'bracket', + nodes: [open] + }); + + define(node, 'parent', prev); + define(open, 'parent', node); + this.push('bracket', node); + prev.nodes.push(node); + }) + + /** + * Bracket text + */ + + .capture('bracket.inner', function() { + if (!this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(not); + if (!m || !m[0]) return; + + var next = this.input.charAt(0); + var val = m[0]; + + var node = pos({ + type: 'bracket.inner', + val: val + }); + + if (val === '\\\\') { + return node; + } + + var first = val.charAt(0); + var last = val.slice(-1); + + if (first === '!') { + val = '^' + val.slice(1); + } + + if (last === '\\' || (val === '^' && next === ']')) { + val += this.input[0]; + this.consume(1); + } + + node.val = val; + return node; + }) + + /** + * Close: ']' + */ + + .capture('bracket.close', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\]/); + if (!m) return; + + var prev = this.prev(); + var last = utils.last(prev.nodes); + + if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) { + last.val = last.val.slice(0, last.val.length - 1); + + return pos({ + type: 'escape', + val: m[0] + }); + } + + var node = pos({ + type: 'bracket.close', + rest: this.input, + val: m[0] + }); + + if (last.type === 'bracket.open') { + node.type = 'bracket.inner'; + node.escaped = true; + return node; + } + + var bracket = this.pop('bracket'); + if (!this.isType(bracket, 'bracket')) { + if (this.options.strict) { + throw new Error('missing opening "["'); + } + node.type = 'bracket.inner'; + node.escaped = true; + return node; + } + + bracket.nodes.push(node); + define(node, 'parent', bracket); + }); +} + +/** + * Brackets parsers + */ + +module.exports = parsers; + +/** + * Expose text regex + */ + +module.exports.TEXT_REGEX = TEXT_REGEX; diff --git a/node_modules/readdirp/node_modules/expand-brackets/lib/utils.js b/node_modules/readdirp/node_modules/expand-brackets/lib/utils.js new file mode 100644 index 00000000..599ff512 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/lib/utils.js @@ -0,0 +1,34 @@ +'use strict'; + +var toRegex = require('to-regex'); +var regexNot = require('regex-not'); +var cached; + +/** + * Get the last element from `array` + * @param {Array} `array` + * @return {*} + */ + +exports.last = function(arr) { + return arr[arr.length - 1]; +}; + +/** + * Create and cache regex to use for text nodes + */ + +exports.createRegex = function(pattern, include) { + if (cached) return cached; + var opts = {contains: true, strictClose: false}; + var not = regexNot.create(pattern, opts); + var re; + + if (typeof include === 'string') { + re = toRegex('^(?:' + include + '|' + not + ')', opts); + } else { + re = toRegex(not, opts); + } + + return (cached = re); +}; diff --git a/node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/LICENSE new file mode 100644 index 00000000..65f90aca --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/define-property/README.md b/node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/README.md new file mode 100644 index 00000000..8cac698a --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/define-property/index.js b/node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/index.js new file mode 100644 index 00000000..3e0e5e13 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/define-property/package.json b/node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property/package.json new file mode 100644 index 00000000..957c66b2 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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": "/readdirp/expand-brackets/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": [ + "/readdirp/expand-brackets" + ], + "_resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "_shasum": "c35b1ef918ec3c990f9a5bc57be04aacec5c8116", + "_spec": "define-property@^0.2.5", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/expand-brackets", + "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/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/LICENSE new file mode 100644 index 00000000..fa30c4cb --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/README.md b/node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/README.md new file mode 100644 index 00000000..cdc45d4f --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/index.js b/node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/index.js new file mode 100644 index 00000000..92a067fc --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/package.json b/node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow/package.json new file mode 100644 index 00000000..56473f8a --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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": "/readdirp/expand-brackets/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": [ + "/readdirp/expand-brackets" + ], + "_resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "_shasum": "51af7d614ad9a9f610ea1bafbb989d6b1c56890f", + "_spec": "extend-shallow@^2.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/expand-brackets", + "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/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/LICENSE new file mode 100644 index 00000000..65f90aca --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/README.md b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/README.md new file mode 100644 index 00000000..3743fe6b --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/index.js b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/index.js new file mode 100644 index 00000000..2ca4af8b --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..d734237b --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/README.md new file mode 100644 index 00000000..6a9df36d --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js new file mode 100644 index 00000000..b52c2917 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/node_modules/kind-of/package.json new file mode 100644 index 00000000..96313188 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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": "/readdirp/expand-brackets/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": [ + "/readdirp/expand-brackets/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": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/package.json b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-accessor-descriptor/package.json new file mode 100644 index 00000000..07cbae2b --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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": "/readdirp/expand-brackets/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": [ + "/readdirp/expand-brackets/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": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/LICENSE new file mode 100644 index 00000000..65f90aca --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/README.md b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/README.md new file mode 100644 index 00000000..41e1643f --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/index.js b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/index.js new file mode 100644 index 00000000..d4d09c92 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..d734237b --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/README.md b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/README.md new file mode 100644 index 00000000..6a9df36d --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/index.js b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/index.js new file mode 100644 index 00000000..b52c2917 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/package.json b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/node_modules/kind-of/package.json new file mode 100644 index 00000000..994b8a73 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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": "/readdirp/expand-brackets/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": [ + "/readdirp/expand-brackets/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": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/package.json b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-data-descriptor/package.json new file mode 100644 index 00000000..035d9653 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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": "/readdirp/expand-brackets/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": [ + "/readdirp/expand-brackets/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": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/LICENSE new file mode 100644 index 00000000..c0d7f136 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/README.md b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/README.md new file mode 100644 index 00000000..658e5330 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/index.js b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/index.js new file mode 100644 index 00000000..c9b91d76 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/package.json b/node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor/package.json new file mode 100644 index 00000000..92d2de9e --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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": "/readdirp/expand-brackets/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": [ + "/readdirp/expand-brackets/define-property" + ], + "_resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "_shasum": "366d8240dde487ca51823b1ab9f07a10a78251ca", + "_spec": "is-descriptor@^0.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/kind-of/LICENSE b/node_modules/readdirp/node_modules/expand-brackets/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/kind-of/README.md b/node_modules/readdirp/node_modules/expand-brackets/node_modules/kind-of/README.md new file mode 100644 index 00000000..170bf304 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/kind-of/index.js b/node_modules/readdirp/node_modules/expand-brackets/node_modules/kind-of/index.js new file mode 100644 index 00000000..fc5cde96 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/node_modules/kind-of/package.json b/node_modules/readdirp/node_modules/expand-brackets/node_modules/kind-of/package.json new file mode 100644 index 00000000..efbb898a --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/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": "/readdirp/expand-brackets/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": [ + "/readdirp/expand-brackets/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "_shasum": "729c91e2d857b7a419a1f9aa65685c4c33f5845d", + "_spec": "kind-of@^5.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/expand-brackets/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/readdirp/node_modules/expand-brackets/package.json b/node_modules/readdirp/node_modules/expand-brackets/package.json new file mode 100644 index 00000000..344be739 --- /dev/null +++ b/node_modules/readdirp/node_modules/expand-brackets/package.json @@ -0,0 +1,133 @@ +{ + "_from": "expand-brackets@^2.1.4", + "_id": "expand-brackets@2.1.4", + "_inBundle": false, + "_integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "_location": "/readdirp/expand-brackets", + "_phantomChildren": { + "is-buffer": "1.1.6", + "is-extendable": "0.1.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "expand-brackets@^2.1.4", + "name": "expand-brackets", + "escapedName": "expand-brackets", + "rawSpec": "^2.1.4", + "saveSpec": null, + "fetchSpec": "^2.1.4" + }, + "_requiredBy": [ + "/readdirp/extglob" + ], + "_resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "_shasum": "b77735e315ce30f6b6eff0f83b04151a22449622", + "_spec": "expand-brackets@^2.1.4", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/extglob", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/expand-brackets/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Elan Shanker", + "url": "https://github.com/es128" + }, + { + "name": "Eugene Sharygin", + "url": "https://github.com/eush77" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Martin Kolárik", + "email": "martin@kolarik.sk", + "url": "http://kolarik.sk" + } + ], + "dependencies": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "deprecated": false, + "description": "Expand POSIX bracket expressions (character classes) in glob patterns.", + "devDependencies": { + "bash-match": "^0.1.1", + "gulp-format-md": "^0.1.10", + "helper-changelog": "^0.3.0", + "minimatch": "^3.0.3", + "mocha": "^3.0.2", + "multimatch": "^2.1.0", + "yargs-parser": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/jonschlinkert/expand-brackets", + "keywords": [ + "bracket", + "brackets", + "character class", + "expand", + "expression", + "posix" + ], + "license": "MIT", + "main": "index.js", + "name": "expand-brackets", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/expand-brackets.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "helpers": [ + "helper-changelog" + ], + "related": { + "list": [ + "braces", + "extglob", + "micromatch", + "nanomatch" + ] + }, + "reflinks": [ + "micromatch", + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "2.1.4" +} diff --git a/node_modules/readdirp/node_modules/extglob/LICENSE b/node_modules/readdirp/node_modules/extglob/LICENSE new file mode 100644 index 00000000..e33d14b7 --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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/readdirp/node_modules/extglob/README.md b/node_modules/readdirp/node_modules/extglob/README.md new file mode 100644 index 00000000..3255ea2b --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/README.md @@ -0,0 +1,362 @@ +# extglob [![NPM version](https://img.shields.io/npm/v/extglob.svg?style=flat)](https://www.npmjs.com/package/extglob) [![NPM monthly downloads](https://img.shields.io/npm/dm/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![NPM total downloads](https://img.shields.io/npm/dt/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![Linux Build Status](https://img.shields.io/travis/micromatch/extglob.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/extglob) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/extglob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/extglob) + +> Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns. + +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 extglob +``` + +* Convert an extglob string to a regex-compatible string. +* More complete (and correct) support than [minimatch](https://github.com/isaacs/minimatch) (minimatch fails a large percentage of the extglob tests) +* Handles [negation patterns](#extglob-patterns) +* Handles [nested patterns](#extglob-patterns) +* Organized code base, easy to maintain and make changes when edge cases arise +* As you can see by the [benchmarks](#benchmarks), extglob doesn't pay with speed for it's completeness, accuracy and quality. + +**Heads up!**: This library only supports extglobs, to handle full glob patterns and other extended globbing features use [micromatch](https://github.com/jonschlinkert/micromatch) instead. + +## Usage + +The main export is a function that takes a string and options, and returns an object with the parsed AST and the compiled `.output`, which is a regex-compatible string that can be used for matching. + +```js +var extglob = require('extglob'); +console.log(extglob('!(xyz)*.js')); +``` + +## Extglob cheatsheet + +Extended globbing patterns can be defined as follows (as described by the [bash man page](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html)): + +| **pattern** | **regex equivalent** | **description** | +| --- | --- | --- | +| `?(pattern-list)` | `(...|...)?` | Matches zero or one occurrence of the given pattern(s) | +| `*(pattern-list)` | `(...|...)*` | Matches zero or more occurrences of the given pattern(s) | +| `+(pattern-list)` | `(...|...)+` | Matches one or more occurrences of the given pattern(s) | +| `@(pattern-list)` | `(...|...)` [1] | Matches one of the given pattern(s) | +| `!(pattern-list)` | N/A | Matches anything except one of the given pattern(s) | + +## API + +### [extglob](index.js#L36) + +Convert the given `extglob` pattern into a regex-compatible string. Returns an object with the compiled result and the parsed AST. + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{String}** + +**Example** + +```js +var extglob = require('extglob'); +console.log(extglob('*.!(*a)')); +//=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' +``` + +### [.match](index.js#L56) + +Takes an array of strings and an extglob pattern and returns a new array that contains only the strings that match the pattern. + +**Params** + +* `list` **{Array}**: Array of strings to match +* `pattern` **{String}**: Extglob pattern +* `options` **{Object}** +* `returns` **{Array}**: Returns an array of matches + +**Example** + +```js +var extglob = require('extglob'); +console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)')); +//=> ['a.b', 'a.c'] +``` + +### [.isMatch](index.js#L111) + +Returns true if the specified `string` matches the given extglob `pattern`. + +**Params** + +* `string` **{String}**: String to match +* `pattern` **{String}**: Extglob pattern +* `options` **{String}** +* `returns` **{Boolean}** + +**Example** + +```js +var extglob = require('extglob'); + +console.log(extglob.isMatch('a.a', '*.!(*a)')); +//=> false +console.log(extglob.isMatch('a.b', '*.!(*a)')); +//=> true +``` + +### [.contains](index.js#L150) + +Returns true if the given `string` contains the given pattern. Similar to `.isMatch` but the pattern can match any part of the string. + +**Params** + +* `str` **{String}**: The string to match. +* `pattern` **{String}**: Glob pattern to use for matching. +* `options` **{Object}** +* `returns` **{Boolean}**: Returns true if the patter matches any part of `str`. + +**Example** + +```js +var extglob = require('extglob'); +console.log(extglob.contains('aa/bb/cc', '*b')); +//=> true +console.log(extglob.contains('aa/bb/cc', '*d')); +//=> false +``` + +### [.matcher](index.js#L184) + +Takes an extglob pattern and returns a matcher function. The returned function takes the string to match as its only argument. + +**Params** + +* `pattern` **{String}**: Extglob pattern +* `options` **{String}** +* `returns` **{Boolean}** + +**Example** + +```js +var extglob = require('extglob'); +var isMatch = extglob.matcher('*.!(*a)'); + +console.log(isMatch('a.a')); +//=> false +console.log(isMatch('a.b')); +//=> true +``` + +### [.create](index.js#L214) + +Convert the given `extglob` pattern into a regex-compatible string. Returns an object with the compiled result and the parsed AST. + +**Params** + +* `str` **{String}** +* `options` **{Object}** +* `returns` **{String}** + +**Example** + +```js +var extglob = require('extglob'); +console.log(extglob.create('*.!(*a)').output); +//=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' +``` + +### [.capture](index.js#L248) + +Returns an array of matches captured by `pattern` in `string`, or `null` if the pattern did not match. + +**Params** + +* `pattern` **{String}**: Glob pattern to use for matching. +* `string` **{String}**: String to match +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns an array of captures if the string matches the glob pattern, otherwise `null`. + +**Example** + +```js +var extglob = require('extglob'); +extglob.capture(pattern, string[, options]); + +console.log(extglob.capture('test/*.js', 'test/foo.js')); +//=> ['foo'] +console.log(extglob.capture('test/*.js', 'foo/bar.css')); +//=> null +``` + +### [.makeRe](index.js#L281) + +Create a regular expression from the given `pattern` and `options`. + +**Params** + +* `pattern` **{String}**: The pattern to convert to regex. +* `options` **{Object}** +* `returns` **{RegExp}** + +**Example** + +```js +var extglob = require('extglob'); +var re = extglob.makeRe('*.!(*a)'); +console.log(re); +//=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/ +``` + +## Options + +Available options are based on the options from Bash (and the option names used in bash). + +### options.nullglob + +**Type**: `boolean` + +**Default**: `undefined` + +When enabled, the pattern itself will be returned when no matches are found. + +### options.nonull + +Alias for [options.nullglob](#optionsnullglob), included for parity with minimatch. + +### options.cache + +**Type**: `boolean` + +**Default**: `undefined` + +Functions are memoized based on the given glob patterns and options. Disable memoization by setting `options.cache` to false. + +### options.failglob + +**Type**: `boolean` + +**Default**: `undefined` + +Throw an error is no matches are found. + +## Benchmarks + +Last run on December 21, 2017 + +```sh +# negation-nested (49 bytes) + extglob x 2,228,255 ops/sec ±0.98% (89 runs sampled) + minimatch x 207,875 ops/sec ±0.61% (91 runs sampled) + + fastest is extglob (by 1072% avg) + +# negation-simple (43 bytes) + extglob x 2,205,668 ops/sec ±1.00% (91 runs sampled) + minimatch x 311,923 ops/sec ±1.25% (91 runs sampled) + + fastest is extglob (by 707% avg) + +# range-false (57 bytes) + extglob x 2,263,877 ops/sec ±0.40% (94 runs sampled) + minimatch x 271,372 ops/sec ±1.02% (91 runs sampled) + + fastest is extglob (by 834% avg) + +# range-true (56 bytes) + extglob x 2,161,891 ops/sec ±0.41% (92 runs sampled) + minimatch x 268,265 ops/sec ±1.17% (91 runs sampled) + + fastest is extglob (by 806% avg) + +# star-simple (46 bytes) + extglob x 2,211,081 ops/sec ±0.49% (92 runs sampled) + minimatch x 343,319 ops/sec ±0.59% (91 runs sampled) + + fastest is extglob (by 644% avg) + +``` + +## Differences from Bash + +This library has complete parity with Bash 4.3 with only a couple of minor differences. + +* In some cases Bash returns true if the given string "contains" the pattern, whereas this library returns true if the string is an exact match for the pattern. You can relax this by setting `options.contains` to true. +* This library is more accurate than Bash and thus does not fail some of the tests that Bash 4.3 still lists as failing in their unit tests + +## 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: + +* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… [more](https://github.com/micromatch/braces) | [homepage](https://github.com/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.") +* [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.") +* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [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. 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/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 49 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [isiahmeadows](https://github.com/isiahmeadows) | +| 1 | [doowb](https://github.com/doowb) | +| 1 | [devongovett](https://github.com/devongovett) | +| 1 | [mjbvz](https://github.com/mjbvz) | +| 1 | [shinnn](https://github.com/shinnn) | + +### 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 21, 2017._ + +
+
+
    +
  1. `@` isn "'t a RegEx character." + +
  2. +
+
\ No newline at end of file diff --git a/node_modules/readdirp/node_modules/extglob/changelog.md b/node_modules/readdirp/node_modules/extglob/changelog.md new file mode 100644 index 00000000..c9fc4fcd --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/changelog.md @@ -0,0 +1,25 @@ +## Changelog + +### v2.0.0 + +**Added features** + +- Adds [.capture](readme.md#capture) method for capturing matches, thanks to [devongovett](https://github.com/devongovett) + + +### v1.0.0 + +**Breaking changes** + +- The main export now returns the compiled string, instead of the object returned from the compiler + +**Added features** + +- Adds a `.create` method to do what the main function did before v1.0.0 + +**Other changes** + +- adds `expand-brackets` parsers/compilers to handle nested brackets and extglobs +- uses `to-regex` to build regex for `makeRe` method +- improves coverage +- optimizations \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/extglob/index.js b/node_modules/readdirp/node_modules/extglob/index.js new file mode 100644 index 00000000..116e6d5c --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/index.js @@ -0,0 +1,331 @@ +'use strict'; + +/** + * Module dependencies + */ + +var extend = require('extend-shallow'); +var unique = require('array-unique'); +var toRegex = require('to-regex'); + +/** + * Local dependencies + */ + +var compilers = require('./lib/compilers'); +var parsers = require('./lib/parsers'); +var Extglob = require('./lib/extglob'); +var utils = require('./lib/utils'); +var MAX_LENGTH = 1024 * 64; + +/** + * Convert the given `extglob` pattern into a regex-compatible string. Returns + * an object with the compiled result and the parsed AST. + * + * ```js + * var extglob = require('extglob'); + * console.log(extglob('*.!(*a)')); + * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {String} + * @api public + */ + +function extglob(pattern, options) { + return extglob.create(pattern, options).output; +} + +/** + * Takes an array of strings and an extglob pattern and returns a new + * array that contains only the strings that match the pattern. + * + * ```js + * var extglob = require('extglob'); + * console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)')); + * //=> ['a.b', 'a.c'] + * ``` + * @param {Array} `list` Array of strings to match + * @param {String} `pattern` Extglob pattern + * @param {Object} `options` + * @return {Array} Returns an array of matches + * @api public + */ + +extglob.match = function(list, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + list = utils.arrayify(list); + var isMatch = extglob.matcher(pattern, options); + var len = list.length; + var idx = -1; + var matches = []; + + while (++idx < len) { + var ele = list[idx]; + + if (isMatch(ele)) { + matches.push(ele); + } + } + + // if no options were passed, uniquify results and return + if (typeof options === 'undefined') { + return unique(matches); + } + + if (matches.length === 0) { + if (options.failglob === true) { + throw new Error('no matches found for "' + pattern + '"'); + } + if (options.nonull === true || options.nullglob === true) { + return [pattern.split('\\').join('')]; + } + } + + return options.nodupes !== false ? unique(matches) : matches; +}; + +/** + * Returns true if the specified `string` matches the given + * extglob `pattern`. + * + * ```js + * var extglob = require('extglob'); + * + * console.log(extglob.isMatch('a.a', '*.!(*a)')); + * //=> false + * console.log(extglob.isMatch('a.b', '*.!(*a)')); + * //=> true + * ``` + * @param {String} `string` String to match + * @param {String} `pattern` Extglob pattern + * @param {String} `options` + * @return {Boolean} + * @api public + */ + +extglob.isMatch = function(str, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + if (pattern === str) { + return true; + } + + if (pattern === '' || pattern === ' ' || pattern === '.') { + return pattern === str; + } + + var isMatch = utils.memoize('isMatch', pattern, options, extglob.matcher); + return isMatch(str); +}; + +/** + * Returns true if the given `string` contains the given pattern. Similar to `.isMatch` but + * the pattern can match any part of the string. + * + * ```js + * var extglob = require('extglob'); + * console.log(extglob.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(extglob.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` + * @return {Boolean} Returns true if the patter matches any part of `str`. + * @api public + */ + +extglob.contains = function(str, pattern, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string'); + } + + if (pattern === '' || pattern === ' ' || pattern === '.') { + return pattern === str; + } + + var opts = extend({}, options, {contains: true}); + opts.strictClose = false; + opts.strictOpen = false; + return extglob.isMatch(str, pattern, opts); +}; + +/** + * Takes an extglob pattern and returns a matcher function. The returned + * function takes the string to match as its only argument. + * + * ```js + * var extglob = require('extglob'); + * var isMatch = extglob.matcher('*.!(*a)'); + * + * console.log(isMatch('a.a')); + * //=> false + * console.log(isMatch('a.b')); + * //=> true + * ``` + * @param {String} `pattern` Extglob pattern + * @param {String} `options` + * @return {Boolean} + * @api public + */ + +extglob.matcher = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + function matcher() { + var re = extglob.makeRe(pattern, options); + return function(str) { + return re.test(str); + }; + } + + return utils.memoize('matcher', pattern, options, matcher); +}; + +/** + * Convert the given `extglob` pattern into a regex-compatible string. Returns + * an object with the compiled result and the parsed AST. + * + * ```js + * var extglob = require('extglob'); + * console.log(extglob.create('*.!(*a)').output); + * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?' + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +extglob.create = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + function create() { + var ext = new Extglob(options); + var ast = ext.parse(pattern, options); + return ext.compile(ast, options); + } + + return utils.memoize('create', pattern, options, create); +}; + +/** + * Returns an array of matches captured by `pattern` in `string`, or `null` + * if the pattern did not match. + * + * ```js + * var extglob = require('extglob'); + * extglob.capture(pattern, string[, options]); + * + * console.log(extglob.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(extglob.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `pattern` Glob pattern to use for matching. + * @param {String} `string` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`. + * @api public + */ + +extglob.capture = function(pattern, str, options) { + var re = extglob.makeRe(pattern, extend({capture: true}, options)); + + function match() { + return function(string) { + var match = re.exec(string); + if (!match) { + return null; + } + + return match.slice(1); + }; + } + + var capture = utils.memoize('capture', pattern, options, match); + return capture(str); +}; + +/** + * Create a regular expression from the given `pattern` and `options`. + * + * ```js + * var extglob = require('extglob'); + * var re = extglob.makeRe('*.!(*a)'); + * console.log(re); + * //=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/ + * ``` + * @param {String} `pattern` The pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +extglob.makeRe = function(pattern, options) { + if (pattern instanceof RegExp) { + return pattern; + } + + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + function makeRe() { + var opts = extend({strictErrors: false}, options); + if (opts.strictErrors === true) opts.strict = true; + var res = extglob.create(pattern, opts); + return toRegex(res.output, opts); + } + + var regex = utils.memoize('makeRe', pattern, options, makeRe); + if (regex.source.length > MAX_LENGTH) { + throw new SyntaxError('potentially malicious regex detected'); + } + + return regex; +}; + +/** + * Cache + */ + +extglob.cache = utils.cache; +extglob.clearCache = function() { + extglob.cache.__data__ = {}; +}; + +/** + * Expose `Extglob` constructor, parsers and compilers + */ + +extglob.Extglob = Extglob; +extglob.compilers = compilers; +extglob.parsers = parsers; + +/** + * Expose `extglob` + * @type {Function} + */ + +module.exports = extglob; diff --git a/node_modules/readdirp/node_modules/extglob/lib/compilers.js b/node_modules/readdirp/node_modules/extglob/lib/compilers.js new file mode 100644 index 00000000..d7bed252 --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/lib/compilers.js @@ -0,0 +1,169 @@ +'use strict'; + +var brackets = require('expand-brackets'); + +/** + * Extglob compilers + */ + +module.exports = function(extglob) { + function star() { + if (typeof extglob.options.star === 'function') { + return extglob.options.star.apply(this, arguments); + } + if (typeof extglob.options.star === 'string') { + return extglob.options.star; + } + return '.*?'; + } + + /** + * Use `expand-brackets` compilers + */ + + extglob.use(brackets.compilers); + extglob.compiler + + /** + * Escaped: "\\*" + */ + + .set('escape', function(node) { + return this.emit(node.val, node); + }) + + /** + * Dot: "." + */ + + .set('dot', function(node) { + return this.emit('\\' + node.val, node); + }) + + /** + * Question mark: "?" + */ + + .set('qmark', function(node) { + var val = '[^\\\\/.]'; + var prev = this.prev(); + + if (node.parsed.slice(-1) === '(') { + var ch = node.rest.charAt(0); + if (ch !== '!' && ch !== '=' && ch !== ':') { + return this.emit(val, node); + } + return this.emit(node.val, node); + } + + if (prev.type === 'text' && prev.val) { + return this.emit(val, node); + } + + if (node.val.length > 1) { + val += '{' + node.val.length + '}'; + } + return this.emit(val, node); + }) + + /** + * Plus: "+" + */ + + .set('plus', function(node) { + var prev = node.parsed.slice(-1); + if (prev === ']' || prev === ')') { + return this.emit(node.val, node); + } + var ch = this.output.slice(-1); + if (!this.output || (/[?*+]/.test(ch) && node.parent.type !== 'bracket')) { + return this.emit('\\+', node); + } + if (/\w/.test(ch) && !node.inside) { + return this.emit('+\\+?', node); + } + return this.emit('+', node); + }) + + /** + * Star: "*" + */ + + .set('star', function(node) { + var prev = this.prev(); + var prefix = prev.type !== 'text' && prev.type !== 'escape' + ? '(?!\\.)' + : ''; + + return this.emit(prefix + star.call(this, node), node); + }) + + /** + * Parens + */ + + .set('paren', function(node) { + return this.mapVisit(node.nodes); + }) + .set('paren.open', function(node) { + var capture = this.options.capture ? '(' : ''; + + switch (node.parent.prefix) { + case '!': + case '^': + return this.emit(capture + '(?:(?!(?:', node); + case '*': + case '+': + case '?': + case '@': + return this.emit(capture + '(?:', node); + default: { + var val = node.val; + if (this.options.bash === true) { + val = '\\' + val; + } else if (!this.options.capture && val === '(' && node.parent.rest[0] !== '?') { + val += '?:'; + } + + return this.emit(val, node); + } + } + }) + .set('paren.close', function(node) { + var capture = this.options.capture ? ')' : ''; + + switch (node.prefix) { + case '!': + case '^': + var prefix = /^(\)|$)/.test(node.rest) ? '$' : ''; + var str = star.call(this, node); + + // if the extglob has a slash explicitly defined, we know the user wants + // to match slashes, so we need to ensure the "star" regex allows for it + if (node.parent.hasSlash && !this.options.star && this.options.slash !== false) { + str = '.*?'; + } + + return this.emit(prefix + ('))' + str + ')') + capture, node); + case '*': + case '+': + case '?': + return this.emit(')' + node.prefix + capture, node); + case '@': + return this.emit(')' + capture, node); + default: { + var val = (this.options.bash === true ? '\\' : '') + ')'; + return this.emit(val, node); + } + } + }) + + /** + * Text + */ + + .set('text', function(node) { + var val = node.val.replace(/[\[\]]/g, '\\$&'); + return this.emit(val, node); + }); +}; diff --git a/node_modules/readdirp/node_modules/extglob/lib/extglob.js b/node_modules/readdirp/node_modules/extglob/lib/extglob.js new file mode 100644 index 00000000..015f9289 --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/lib/extglob.js @@ -0,0 +1,78 @@ +'use strict'; + +/** + * Module dependencies + */ + +var Snapdragon = require('snapdragon'); +var define = require('define-property'); +var extend = require('extend-shallow'); + +/** + * Local dependencies + */ + +var compilers = require('./compilers'); +var parsers = require('./parsers'); + +/** + * Customize Snapdragon parser and renderer + */ + +function Extglob(options) { + this.options = extend({source: 'extglob'}, options); + this.snapdragon = this.options.snapdragon || new Snapdragon(this.options); + this.snapdragon.patterns = this.snapdragon.patterns || {}; + this.compiler = this.snapdragon.compiler; + this.parser = this.snapdragon.parser; + + compilers(this.snapdragon); + parsers(this.snapdragon); + + /** + * Override Snapdragon `.parse` method + */ + + define(this.snapdragon, 'parse', function(str, options) { + var parsed = Snapdragon.prototype.parse.apply(this, arguments); + parsed.input = str; + + // escape unmatched brace/bracket/parens + var last = this.parser.stack.pop(); + if (last && this.options.strict !== true) { + var node = last.nodes[0]; + node.val = '\\' + node.val; + var sibling = node.parent.nodes[1]; + if (sibling.type === 'star') { + sibling.loose = true; + } + } + + // add non-enumerable parser reference + define(parsed, 'parser', this.parser); + return parsed; + }); + + /** + * Decorate `.parse` method + */ + + define(this, 'parse', function(ast, options) { + return this.snapdragon.parse.apply(this.snapdragon, arguments); + }); + + /** + * Decorate `.compile` method + */ + + define(this, 'compile', function(ast, options) { + return this.snapdragon.compile.apply(this.snapdragon, arguments); + }); + +} + +/** + * Expose `Extglob` + */ + +module.exports = Extglob; diff --git a/node_modules/readdirp/node_modules/extglob/lib/parsers.js b/node_modules/readdirp/node_modules/extglob/lib/parsers.js new file mode 100644 index 00000000..2ba7352e --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/lib/parsers.js @@ -0,0 +1,156 @@ +'use strict'; + +var brackets = require('expand-brackets'); +var define = require('define-property'); +var utils = require('./utils'); + +/** + * Characters to use in text regex (we want to "not" match + * characters that are matched by other parsers) + */ + +var TEXT_REGEX = '([!@*?+]?\\(|\\)|[*?.+\\\\]|\\[:?(?=.*\\])|:?\\])+'; +var not = utils.createRegex(TEXT_REGEX); + +/** + * Extglob parsers + */ + +function parsers(extglob) { + extglob.state = extglob.state || {}; + + /** + * Use `expand-brackets` parsers + */ + + extglob.use(brackets.parsers); + extglob.parser.sets.paren = extglob.parser.sets.paren || []; + extglob.parser + + /** + * Extglob open: "*(" + */ + + .capture('paren.open', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^([!@*?+])?\(/); + if (!m) return; + + var prev = this.prev(); + var prefix = m[1]; + var val = m[0]; + + var open = pos({ + type: 'paren.open', + parsed: parsed, + val: val + }); + + var node = pos({ + type: 'paren', + prefix: prefix, + nodes: [open] + }); + + // if nested negation extglobs, just cancel them out to simplify + if (prefix === '!' && prev.type === 'paren' && prev.prefix === '!') { + prev.prefix = '@'; + node.prefix = '@'; + } + + define(node, 'rest', this.input); + define(node, 'parsed', parsed); + define(node, 'parent', prev); + define(open, 'parent', node); + + this.push('paren', node); + prev.nodes.push(node); + }) + + /** + * Extglob close: ")" + */ + + .capture('paren.close', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\)/); + if (!m) return; + + var parent = this.pop('paren'); + var node = pos({ + type: 'paren.close', + rest: this.input, + parsed: parsed, + val: m[0] + }); + + if (!this.isType(parent, 'paren')) { + if (this.options.strict) { + throw new Error('missing opening paren: "("'); + } + node.escaped = true; + return node; + } + + node.prefix = parent.prefix; + parent.nodes.push(node); + define(node, 'parent', parent); + }) + + /** + * Escape: "\\." + */ + + .capture('escape', function() { + var pos = this.position(); + var m = this.match(/^\\(.)/); + if (!m) return; + + return pos({ + type: 'escape', + val: m[0], + ch: m[1] + }); + }) + + /** + * Question marks: "?" + */ + + .capture('qmark', function() { + var parsed = this.parsed; + var pos = this.position(); + var m = this.match(/^\?+(?!\()/); + if (!m) return; + extglob.state.metachar = true; + return pos({ + type: 'qmark', + rest: this.input, + parsed: parsed, + val: m[0] + }); + }) + + /** + * Character parsers + */ + + .capture('star', /^\*(?!\()/) + .capture('plus', /^\+(?!\()/) + .capture('dot', /^\./) + .capture('text', not); +}; + +/** + * Expose text regex string + */ + +module.exports.TEXT_REGEX = TEXT_REGEX; + +/** + * Extglob parsers + */ + +module.exports = parsers; diff --git a/node_modules/readdirp/node_modules/extglob/lib/utils.js b/node_modules/readdirp/node_modules/extglob/lib/utils.js new file mode 100644 index 00000000..37a59fbc --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/lib/utils.js @@ -0,0 +1,69 @@ +'use strict'; + +var regex = require('regex-not'); +var Cache = require('fragment-cache'); + +/** + * Utils + */ + +var utils = module.exports; +var cache = utils.cache = new Cache(); + +/** + * Cast `val` to an array + * @return {Array} + */ + +utils.arrayify = function(val) { + if (!Array.isArray(val)) { + return [val]; + } + return val; +}; + +/** + * Memoize a generated regex or function + */ + +utils.memoize = function(type, pattern, options, fn) { + var key = utils.createKey(type + pattern, options); + + if (cache.has(type, key)) { + return cache.get(type, key); + } + + var val = fn(pattern, options); + if (options && options.cache === false) { + return val; + } + + cache.set(type, key, val); + return val; +}; + +/** + * 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. + */ + +utils.createKey = function(pattern, options) { + var key = pattern; + if (typeof options === 'undefined') { + return key; + } + for (var prop in options) { + key += ';' + prop + '=' + String(options[prop]); + } + return key; +}; + +/** + * Create the regex to use for matching text + */ + +utils.createRegex = function(str) { + var opts = {contains: true, strictClose: false}; + return regex(str, opts); +}; diff --git a/node_modules/readdirp/node_modules/extglob/node_modules/define-property/LICENSE b/node_modules/readdirp/node_modules/extglob/node_modules/define-property/LICENSE new file mode 100644 index 00000000..ec85897e --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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/readdirp/node_modules/extglob/node_modules/define-property/README.md b/node_modules/readdirp/node_modules/extglob/node_modules/define-property/README.md new file mode 100644 index 00000000..2f1af05f --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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/readdirp/node_modules/extglob/node_modules/define-property/index.js b/node_modules/readdirp/node_modules/extglob/node_modules/define-property/index.js new file mode 100644 index 00000000..27c19ebf --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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/readdirp/node_modules/extglob/node_modules/define-property/package.json b/node_modules/readdirp/node_modules/extglob/node_modules/define-property/package.json new file mode 100644 index 00000000..efc4592a --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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": "/readdirp/extglob/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": [ + "/readdirp/extglob" + ], + "_resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "_shasum": "769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6", + "_spec": "define-property@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/extglob", + "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/readdirp/node_modules/extglob/node_modules/extend-shallow/LICENSE b/node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow/LICENSE new file mode 100644 index 00000000..fa30c4cb --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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/readdirp/node_modules/extglob/node_modules/extend-shallow/README.md b/node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow/README.md new file mode 100644 index 00000000..cdc45d4f --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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/readdirp/node_modules/extglob/node_modules/extend-shallow/index.js b/node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow/index.js new file mode 100644 index 00000000..92a067fc --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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/readdirp/node_modules/extglob/node_modules/extend-shallow/package.json b/node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow/package.json new file mode 100644 index 00000000..adaa5411 --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/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": "/readdirp/extglob/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": [ + "/readdirp/extglob" + ], + "_resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "_shasum": "51af7d614ad9a9f610ea1bafbb989d6b1c56890f", + "_spec": "extend-shallow@^2.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/extglob", + "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/readdirp/node_modules/extglob/package.json b/node_modules/readdirp/node_modules/extglob/package.json new file mode 100644 index 00000000..59c9b014 --- /dev/null +++ b/node_modules/readdirp/node_modules/extglob/package.json @@ -0,0 +1,160 @@ +{ + "_from": "extglob@^2.0.4", + "_id": "extglob@2.0.4", + "_inBundle": false, + "_integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "_location": "/readdirp/extglob", + "_phantomChildren": { + "is-descriptor": "1.0.2", + "is-extendable": "0.1.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "extglob@^2.0.4", + "name": "extglob", + "escapedName": "extglob", + "rawSpec": "^2.0.4", + "saveSpec": null, + "fetchSpec": "^2.0.4" + }, + "_requiredBy": [ + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "_shasum": "ad00fe4dc612a9232e8718711dc5cb5ab0285543", + "_spec": "extglob@^2.0.4", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/micromatch/extglob/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Devon Govett", + "url": "http://badassjs.com" + }, + { + "name": "Isiah Meadows", + "url": "https://www.isiahmeadows.com" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Matt Bierner", + "url": "http://mattbierner.com" + }, + { + "name": "Shinnosuke Watanabe", + "url": "https://shinnn.github.io" + } + ], + "dependencies": { + "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.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "deprecated": false, + "description": "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.", + "devDependencies": { + "bash-match": "^1.0.2", + "for-own": "^1.0.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", + "helper-changelog": "^0.3.0", + "is-windows": "^1.0.1", + "micromatch": "^3.0.4", + "minimatch": "^3.0.4", + "minimist": "^1.2.0", + "mocha": "^3.5.0", + "multimatch": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/micromatch/extglob", + "keywords": [ + "bash", + "extended", + "extglob", + "glob", + "globbing", + "ksh", + "match", + "pattern", + "patterns", + "regex", + "test", + "wildcard" + ], + "license": "MIT", + "lintDeps": { + "devDependencies": { + "files": { + "options": { + "ignore": [ + "benchmark/**/*.js" + ] + } + } + } + }, + "main": "index.js", + "name": "extglob", + "repository": { + "type": "git", + "url": "git+https://github.com/micromatch/extglob.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "related": { + "list": [ + "braces", + "expand-brackets", + "expand-range", + "fill-range", + "micromatch" + ] + }, + "helpers": [ + "helper-changelog" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "2.0.4" +} diff --git a/node_modules/readdirp/node_modules/fill-range/LICENSE b/node_modules/readdirp/node_modules/fill-range/LICENSE new file mode 100644 index 00000000..d734237b --- /dev/null +++ b/node_modules/readdirp/node_modules/fill-range/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/readdirp/node_modules/fill-range/README.md b/node_modules/readdirp/node_modules/fill-range/README.md new file mode 100644 index 00000000..bc1f8a04 --- /dev/null +++ b/node_modules/readdirp/node_modules/fill-range/README.md @@ -0,0 +1,250 @@ +# fill-range [![NPM version](https://img.shields.io/npm/v/fill-range.svg?style=flat)](https://www.npmjs.com/package/fill-range) [![NPM monthly downloads](https://img.shields.io/npm/dm/fill-range.svg?style=flat)](https://npmjs.org/package/fill-range) [![NPM total downloads](https://img.shields.io/npm/dt/fill-range.svg?style=flat)](https://npmjs.org/package/fill-range) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/fill-range.svg?style=flat&label=Travis)](https://travis-ci.org/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` + +## Table of Contents + +- [Install](#install) +- [Usage](#usage) +- [Examples](#examples) +- [Options](#options) + * [options.step](#optionsstep) + * [options.strictRanges](#optionsstrictranges) + * [options.stringify](#optionsstringify) + * [options.toRegex](#optionstoregex) + * [options.transform](#optionstransform) +- [About](#about) + +_(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 fill-range +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add fill-range +``` + +## Usage + +Expands numbers and letters, optionally using a `step` as the last argument. _(Numbers may be defined as JavaScript numbers or strings)_. + +```js +var fill = require('fill-range'); +fill(from, to[, step, options]); + +// examples +console.log(fill('1', '10')); //=> '[ '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ]' +console.log(fill('1', '10', {toRegex: true})); //=> [1-9]|10 +``` + +**Params** + +* `from`: **{String|Number}** the number or letter to start with +* `to`: **{String|Number}** the number or letter to end with +* `step`: **{String|Number|Object|Function}** Optionally pass a [step](#optionsstep) to use. +* `options`: **{Object|Function}**: See all available [options](#options) + +## Examples + +By default, an array of values is returned. + +**Alphabetical ranges** + +```js +console.log(fill('a', 'e')); //=> ['a', 'b', 'c', 'd', 'e'] +console.log(fill('A', 'E')); //=> [ 'A', 'B', 'C', 'D', 'E' ] +``` + +**Numerical ranges** + +Numbers can be defined as actual numbers or strings. + +```js +console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ] +console.log(fill('1', '5')); //=> [ 1, 2, 3, 4, 5 ] +``` + +**Negative ranges** + +Numbers can be defined as actual numbers or strings. + +```js +console.log(fill('-5', '-1')); //=> [ '-5', '-4', '-3', '-2', '-1' ] +console.log(fill('-5', '5')); //=> [ '-5', '-4', '-3', '-2', '-1', '0', '1', '2', '3', '4', '5' ] +``` + +**Steps (increments)** + +```js +// numerical ranges with increments +console.log(fill('0', '25', 4)); //=> [ '0', '4', '8', '12', '16', '20', '24' ] +console.log(fill('0', '25', 5)); //=> [ '0', '5', '10', '15', '20', '25' ] +console.log(fill('0', '25', 6)); //=> [ '0', '6', '12', '18', '24' ] + +// alphabetical ranges with increments +console.log(fill('a', 'z', 4)); //=> [ 'a', 'e', 'i', 'm', 'q', 'u', 'y' ] +console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ] +console.log(fill('a', 'z', 6)); //=> [ 'a', 'g', 'm', 's', 'y' ] +``` + +## Options + +### options.step + +**Type**: `number` (formatted as a string or number) + +**Default**: `undefined` + +**Description**: The increment to use for the range. Can be used with letters or numbers. + +**Example(s)** + +```js +// numbers +console.log(fill('1', '10', 2)); //=> [ '1', '3', '5', '7', '9' ] +console.log(fill('1', '10', 3)); //=> [ '1', '4', '7', '10' ] +console.log(fill('1', '10', 4)); //=> [ '1', '5', '9' ] + +// letters +console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ] +console.log(fill('a', 'z', 7)); //=> [ 'a', 'h', 'o', 'v' ] +console.log(fill('a', 'z', 9)); //=> [ 'a', 'j', 's' ] +``` + +### options.strictRanges + +**Type**: `boolean` + +**Default**: `false` + +**Description**: By default, `null` is returned when an invalid range is passed. Enable this option to throw a `RangeError` on invalid ranges. + +**Example(s)** + +The following are all invalid: + +```js +fill('1.1', '2'); // decimals not supported in ranges +fill('a', '2'); // incompatible range values +fill(1, 10, 'foo'); // invalid "step" argument +``` + +### options.stringify + +**Type**: `boolean` + +**Default**: `undefined` + +**Description**: Cast all returned values to strings. By default, integers are returned as numbers. + +**Example(s)** + +```js +console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ] +console.log(fill(1, 5, {stringify: true})); //=> [ '1', '2', '3', '4', '5' ] +``` + +### options.toRegex + +**Type**: `boolean` + +**Default**: `undefined` + +**Description**: Create a regex-compatible source string, instead of expanding values to an array. + +**Example(s)** + +```js +// alphabetical range +console.log(fill('a', 'e', {toRegex: true})); //=> '[a-e]' +// alphabetical with step +console.log(fill('a', 'z', 3, {toRegex: true})); //=> 'a|d|g|j|m|p|s|v|y' +// numerical range +console.log(fill('1', '100', {toRegex: true})); //=> '[1-9]|[1-9][0-9]|100' +// numerical range with zero padding +console.log(fill('000001', '100000', {toRegex: true})); +//=> '0{5}[1-9]|0{4}[1-9][0-9]|0{3}[1-9][0-9]{2}|0{2}[1-9][0-9]{3}|0[1-9][0-9]{4}|100000' +``` + +### options.transform + +**Type**: `function` + +**Default**: `undefined` + +**Description**: Customize each value in the returned array (or [string](#optionstoRegex)). _(you can also pass this function as the last argument to `fill()`)_. + +**Example(s)** + +```js +// increase padding by two +var arr = fill('01', '05', function(val, a, b, step, idx, arr, options) { + return repeat('0', (options.maxLength + 2) - val.length) + val; +}); + +console.log(arr); +//=> ['0001', '0002', '0003', '0004', '0005'] +``` + +## About + +### Related projects + +* [braces](https://www.npmjs.com/package/braces): Fast, comprehensive, bash-like brace expansion implemented in JavaScript. Complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fast, comprehensive, bash-like brace expansion implemented in JavaScript. Complete support for the Bash 4.3 braces specification, without sacrificing speed.") +* [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.") +* [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.") +* [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/jonschlinkert/to-regex-range) | [homepage](https://github.com/jonschlinkert/to-regex-range "Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.87 million test assertions.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 103 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [paulmillr](https://github.com/paulmillr) | +| 1 | [edorivai](https://github.com/edorivai) | +| 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.5.0, on April 23, 2017._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/fill-range/index.js b/node_modules/readdirp/node_modules/fill-range/index.js new file mode 100644 index 00000000..294a2edd --- /dev/null +++ b/node_modules/readdirp/node_modules/fill-range/index.js @@ -0,0 +1,208 @@ +/*! + * fill-range + * + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var util = require('util'); +var isNumber = require('is-number'); +var extend = require('extend-shallow'); +var repeat = require('repeat-string'); +var toRegex = require('to-regex-range'); + +/** + * Return a range of numbers or letters. + * + * @param {String} `start` Start of the range + * @param {String} `stop` End of the range + * @param {String} `step` Increment or decrement to use. + * @param {Function} `fn` Custom function to modify each element in the range. + * @return {Array} + */ + +function fillRange(start, stop, step, options) { + if (typeof start === 'undefined') { + return []; + } + + if (typeof stop === 'undefined' || start === stop) { + // special case, for handling negative zero + var isString = typeof start === 'string'; + if (isNumber(start) && !toNumber(start)) { + return [isString ? '0' : 0]; + } + return [start]; + } + + if (typeof step !== 'number' && typeof step !== 'string') { + options = step; + step = undefined; + } + + if (typeof options === 'function') { + options = { transform: options }; + } + + var opts = extend({step: step}, options); + if (opts.step && !isValidNumber(opts.step)) { + if (opts.strictRanges === true) { + throw new TypeError('expected options.step to be a number'); + } + return []; + } + + opts.isNumber = isValidNumber(start) && isValidNumber(stop); + if (!opts.isNumber && !isValid(start, stop)) { + if (opts.strictRanges === true) { + throw new RangeError('invalid range arguments: ' + util.inspect([start, stop])); + } + return []; + } + + opts.isPadded = isPadded(start) || isPadded(stop); + opts.toString = opts.stringify + || typeof opts.step === 'string' + || typeof start === 'string' + || typeof stop === 'string' + || !opts.isNumber; + + if (opts.isPadded) { + opts.maxLength = Math.max(String(start).length, String(stop).length); + } + + // support legacy minimatch/fill-range options + if (typeof opts.optimize === 'boolean') opts.toRegex = opts.optimize; + if (typeof opts.makeRe === 'boolean') opts.toRegex = opts.makeRe; + return expand(start, stop, opts); +} + +function expand(start, stop, options) { + var a = options.isNumber ? toNumber(start) : start.charCodeAt(0); + var b = options.isNumber ? toNumber(stop) : stop.charCodeAt(0); + + var step = Math.abs(toNumber(options.step)) || 1; + if (options.toRegex && step === 1) { + return toRange(a, b, start, stop, options); + } + + var zero = {greater: [], lesser: []}; + var asc = a < b; + var arr = new Array(Math.round((asc ? b - a : a - b) / step)); + var idx = 0; + + while (asc ? a <= b : a >= b) { + var val = options.isNumber ? a : String.fromCharCode(a); + if (options.toRegex && (val >= 0 || !options.isNumber)) { + zero.greater.push(val); + } else { + zero.lesser.push(Math.abs(val)); + } + + if (options.isPadded) { + val = zeros(val, options); + } + + if (options.toString) { + val = String(val); + } + + if (typeof options.transform === 'function') { + arr[idx++] = options.transform(val, a, b, step, idx, arr, options); + } else { + arr[idx++] = val; + } + + if (asc) { + a += step; + } else { + a -= step; + } + } + + if (options.toRegex === true) { + return toSequence(arr, zero, options); + } + return arr; +} + +function toRange(a, b, start, stop, options) { + if (options.isPadded) { + return toRegex(start, stop, options); + } + + if (options.isNumber) { + return toRegex(Math.min(a, b), Math.max(a, b), options); + } + + var start = String.fromCharCode(Math.min(a, b)); + var stop = String.fromCharCode(Math.max(a, b)); + return '[' + start + '-' + stop + ']'; +} + +function toSequence(arr, zeros, options) { + var greater = '', lesser = ''; + if (zeros.greater.length) { + greater = zeros.greater.join('|'); + } + if (zeros.lesser.length) { + lesser = '-(' + zeros.lesser.join('|') + ')'; + } + var res = greater && lesser + ? greater + '|' + lesser + : greater || lesser; + + if (options.capture) { + return '(' + res + ')'; + } + return res; +} + +function zeros(val, options) { + if (options.isPadded) { + var str = String(val); + var len = str.length; + var dash = ''; + if (str.charAt(0) === '-') { + dash = '-'; + str = str.slice(1); + } + var diff = options.maxLength - len; + var pad = repeat('0', diff); + val = (dash + pad + str); + } + if (options.stringify) { + return String(val); + } + return val; +} + +function toNumber(val) { + return Number(val) || 0; +} + +function isPadded(str) { + return /^-?0\d/.test(str); +} + +function isValid(min, max) { + return (isValidNumber(min) || isValidLetter(min)) + && (isValidNumber(max) || isValidLetter(max)); +} + +function isValidLetter(ch) { + return typeof ch === 'string' && ch.length === 1 && /^\w+$/.test(ch); +} + +function isValidNumber(n) { + return isNumber(n) && !/\./.test(n); +} + +/** + * Expose `fillRange` + * @type {Function} + */ + +module.exports = fillRange; diff --git a/node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/LICENSE b/node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/LICENSE new file mode 100644 index 00000000..fa30c4cb --- /dev/null +++ b/node_modules/readdirp/node_modules/fill-range/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/readdirp/node_modules/fill-range/node_modules/extend-shallow/README.md b/node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/README.md new file mode 100644 index 00000000..cdc45d4f --- /dev/null +++ b/node_modules/readdirp/node_modules/fill-range/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/readdirp/node_modules/fill-range/node_modules/extend-shallow/index.js b/node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/index.js new file mode 100644 index 00000000..92a067fc --- /dev/null +++ b/node_modules/readdirp/node_modules/fill-range/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/readdirp/node_modules/fill-range/node_modules/extend-shallow/package.json b/node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow/package.json new file mode 100644 index 00000000..2d4fa90d --- /dev/null +++ b/node_modules/readdirp/node_modules/fill-range/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": "/readdirp/fill-range/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": [ + "/readdirp/fill-range" + ], + "_resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "_shasum": "51af7d614ad9a9f610ea1bafbb989d6b1c56890f", + "_spec": "extend-shallow@^2.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/fill-range", + "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/readdirp/node_modules/fill-range/package.json b/node_modules/readdirp/node_modules/fill-range/package.json new file mode 100644 index 00000000..4f5cd021 --- /dev/null +++ b/node_modules/readdirp/node_modules/fill-range/package.json @@ -0,0 +1,130 @@ +{ + "_from": "fill-range@^4.0.0", + "_id": "fill-range@4.0.0", + "_inBundle": false, + "_integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "_location": "/readdirp/fill-range", + "_phantomChildren": { + "is-extendable": "0.1.1" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "fill-range@^4.0.0", + "name": "fill-range", + "escapedName": "fill-range", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/readdirp/braces" + ], + "_resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "_shasum": "d544811d428f98eb06a63dc402d2403c328c38f7", + "_spec": "fill-range@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/fill-range/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "email": "wtgtybhertgeghgtwtg@gmail.com", + "url": "https://github.com/wtgtybhertgeghgtwtg" + }, + { + "name": "Edo Rivai", + "email": "edo.rivai@gmail.com", + "url": "edo.rivai.nl" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Paul Miller", + "email": "paul+gh@paulmillr.com", + "url": "paulmillr.com" + } + ], + "dependencies": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "deprecated": false, + "description": "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`", + "devDependencies": { + "ansi-cyan": "^0.1.1", + "benchmarked": "^1.0.0", + "gulp-format-md": "^0.1.12", + "minimist": "^1.2.0", + "mocha": "^3.2.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/fill-range", + "keywords": [ + "alpha", + "alphabetical", + "array", + "bash", + "brace", + "expand", + "expansion", + "fill", + "glob", + "match", + "matches", + "matching", + "number", + "numerical", + "range", + "ranges", + "regex", + "sh" + ], + "license": "MIT", + "main": "index.js", + "name": "fill-range", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/fill-range.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "braces", + "expand-range", + "micromatch", + "to-regex-range" + ] + }, + "toc": true, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "4.0.0" +} diff --git a/node_modules/readdirp/node_modules/is-accessor-descriptor/LICENSE b/node_modules/readdirp/node_modules/is-accessor-descriptor/LICENSE new file mode 100644 index 00000000..e33d14b7 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-accessor-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. diff --git a/node_modules/readdirp/node_modules/is-accessor-descriptor/README.md b/node_modules/readdirp/node_modules/is-accessor-descriptor/README.md new file mode 100644 index 00000000..d198e1f0 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-accessor-descriptor/README.md @@ -0,0 +1,144 @@ +# is-accessor-descriptor [![NPM version](https://img.shields.io/npm/v/is-accessor-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-accessor-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-accessor-descriptor.svg?style=flat)](https://npmjs.org/package/is-accessor-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-accessor-descriptor.svg?style=flat)](https://npmjs.org/package/is-accessor-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-accessor-descriptor.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-accessor-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. + +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 is-accessor-descriptor +``` + +## 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 +``` + +## 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-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.") +* [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 "Returns true if an object was created by the `Object` constructor.") +* [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.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 22 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [realityking](https://github.com/realityking) | + +### 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 01, 2017._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/is-accessor-descriptor/index.js b/node_modules/readdirp/node_modules/is-accessor-descriptor/index.js new file mode 100644 index 00000000..d2e6fe8b --- /dev/null +++ b/node_modules/readdirp/node_modules/is-accessor-descriptor/index.js @@ -0,0 +1,69 @@ +/*! + * is-accessor-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released 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/readdirp/node_modules/is-accessor-descriptor/package.json b/node_modules/readdirp/node_modules/is-accessor-descriptor/package.json new file mode 100644 index 00000000..f33815c4 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-accessor-descriptor/package.json @@ -0,0 +1,110 @@ +{ + "_from": "is-accessor-descriptor@^1.0.0", + "_id": "is-accessor-descriptor@1.0.0", + "_inBundle": false, + "_integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "_location": "/readdirp/is-accessor-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-accessor-descriptor@^1.0.0", + "name": "is-accessor-descriptor", + "escapedName": "is-accessor-descriptor", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/readdirp/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "_shasum": "169c2f6d3df1f992618072365c9b0ea1f6878656", + "_spec": "is-accessor-descriptor@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Rouven Weßling", + "url": "www.rouvenwessling.de" + } + ], + "dependencies": { + "kind-of": "^6.0.0" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "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": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "is-plain-object", + "isobject" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "1.0.0" +} diff --git a/node_modules/readdirp/node_modules/is-data-descriptor/LICENSE b/node_modules/readdirp/node_modules/is-data-descriptor/LICENSE new file mode 100644 index 00000000..e33d14b7 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-data-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. diff --git a/node_modules/readdirp/node_modules/is-data-descriptor/README.md b/node_modules/readdirp/node_modules/is-data-descriptor/README.md new file mode 100644 index 00000000..42b07144 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-data-descriptor/README.md @@ -0,0 +1,161 @@ +# is-data-descriptor [![NPM version](https://img.shields.io/npm/v/is-data-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-data-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-data-descriptor.svg?style=flat)](https://npmjs.org/package/is-data-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-data-descriptor.svg?style=flat)](https://npmjs.org/package/is-data-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-data-descriptor.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-data-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript data descriptor. + +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 is-data-descriptor +``` + +## 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' +``` + +## 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-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.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 21 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [realityking](https://github.com/realityking) | + +### 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 01, 2017._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/is-data-descriptor/index.js b/node_modules/readdirp/node_modules/is-data-descriptor/index.js new file mode 100644 index 00000000..cfeae361 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-data-descriptor/index.js @@ -0,0 +1,49 @@ +/*! + * is-data-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +module.exports = function isDataDescriptor(obj, prop) { + // data descriptor properties + var data = { + configurable: 'boolean', + enumerable: 'boolean', + writable: 'boolean' + }; + + 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; +}; diff --git a/node_modules/readdirp/node_modules/is-data-descriptor/package.json b/node_modules/readdirp/node_modules/is-data-descriptor/package.json new file mode 100644 index 00000000..751f2e7d --- /dev/null +++ b/node_modules/readdirp/node_modules/is-data-descriptor/package.json @@ -0,0 +1,109 @@ +{ + "_from": "is-data-descriptor@^1.0.0", + "_id": "is-data-descriptor@1.0.0", + "_inBundle": false, + "_integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "_location": "/readdirp/is-data-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-data-descriptor@^1.0.0", + "name": "is-data-descriptor", + "escapedName": "is-data-descriptor", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/readdirp/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "_shasum": "d84876321d0e7add03990406abbbbd36ba9268c7", + "_spec": "is-data-descriptor@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Rouven Weßling", + "url": "www.rouvenwessling.de" + } + ], + "dependencies": { + "kind-of": "^6.0.0" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript data descriptor.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "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": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "1.0.0" +} diff --git a/node_modules/readdirp/node_modules/is-descriptor/LICENSE b/node_modules/readdirp/node_modules/is-descriptor/LICENSE new file mode 100644 index 00000000..c0d7f136 --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/is-descriptor/README.md b/node_modules/readdirp/node_modules/is-descriptor/README.md new file mode 100644 index 00000000..658e5330 --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/is-descriptor/index.js b/node_modules/readdirp/node_modules/is-descriptor/index.js new file mode 100644 index 00000000..c9b91d76 --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/is-descriptor/package.json b/node_modules/readdirp/node_modules/is-descriptor/package.json new file mode 100644 index 00000000..fefa3200 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-descriptor/package.json @@ -0,0 +1,114 @@ +{ + "_from": "is-descriptor@^1.0.0", + "_id": "is-descriptor@1.0.2", + "_inBundle": false, + "_integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "_location": "/readdirp/is-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-descriptor@^1.0.0", + "name": "is-descriptor", + "escapedName": "is-descriptor", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/readdirp/extglob/define-property" + ], + "_resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "_shasum": "3b159746a66604b04f8c81524ba365c5f14d86ec", + "_spec": "is-descriptor@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/extglob/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": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "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.5.3" + }, + "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": "1.0.2" +} diff --git a/node_modules/readdirp/node_modules/is-number/LICENSE b/node_modules/readdirp/node_modules/is-number/LICENSE new file mode 100644 index 00000000..842218cf --- /dev/null +++ b/node_modules/readdirp/node_modules/is-number/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/readdirp/node_modules/is-number/README.md b/node_modules/readdirp/node_modules/is-number/README.md new file mode 100644 index 00000000..281165dc --- /dev/null +++ b/node_modules/readdirp/node_modules/is-number/README.md @@ -0,0 +1,115 @@ +# is-number [![NPM version](https://img.shields.io/npm/v/is-number.svg?style=flat)](https://www.npmjs.com/package/is-number) [![NPM downloads](https://img.shields.io/npm/dm/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-number.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-number) + +> Returns true if the value is a number. comprehensive tests. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-number +``` + +## Usage + +To understand some of the rationale behind the decisions made in this library (and to learn about some oddities of number evaluation in JavaScript), [see this gist](https://gist.github.com/jonschlinkert/e30c70c713da325d0e81). + +```js +var isNumber = require('is-number'); +``` + +### true + +See the [tests](./test.js) for more examples. + +```js +isNumber(5e3) //=> 'true' +isNumber(0xff) //=> 'true' +isNumber(-1.1) //=> 'true' +isNumber(0) //=> 'true' +isNumber(1) //=> 'true' +isNumber(1.1) //=> 'true' +isNumber(10) //=> 'true' +isNumber(10.10) //=> 'true' +isNumber(100) //=> 'true' +isNumber('-1.1') //=> 'true' +isNumber('0') //=> 'true' +isNumber('012') //=> 'true' +isNumber('0xff') //=> 'true' +isNumber('1') //=> 'true' +isNumber('1.1') //=> 'true' +isNumber('10') //=> 'true' +isNumber('10.10') //=> 'true' +isNumber('100') //=> 'true' +isNumber('5e3') //=> 'true' +isNumber(parseInt('012')) //=> 'true' +isNumber(parseFloat('012')) //=> 'true' +``` + +### False + +See the [tests](./test.js) for more examples. + +```js +isNumber('foo') //=> 'false' +isNumber([1]) //=> 'false' +isNumber([]) //=> 'false' +isNumber(function () {}) //=> 'false' +isNumber(Infinity) //=> 'false' +isNumber(NaN) //=> 'false' +isNumber(new Array('abc')) //=> 'false' +isNumber(new Array(2)) //=> 'false' +isNumber(new Buffer('abc')) //=> 'false' +isNumber(null) //=> 'false' +isNumber(undefined) //=> 'false' +isNumber({abc: 'abc'}) //=> 'false' +``` + +## About + +### Related projects + +* [even](https://www.npmjs.com/package/even): Get the even numbered items from an array. | [homepage](https://github.com/jonschlinkert/even "Get the even numbered items from an array.") +* [is-even](https://www.npmjs.com/package/is-even): Return true if the given number is even. | [homepage](https://github.com/jonschlinkert/is-even "Return true if the given number is even.") +* [is-odd](https://www.npmjs.com/package/is-odd): Returns true if the given number is odd. | [homepage](https://github.com/jonschlinkert/is-odd "Returns true if the given number is odd.") +* [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. ") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") +* [odd](https://www.npmjs.com/package/odd): Get the odd numbered items from an array. | [homepage](https://github.com/jonschlinkert/odd "Get the odd numbered items from an array.") + +### 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/is-number/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.30, on September 10, 2016._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/is-number/index.js b/node_modules/readdirp/node_modules/is-number/index.js new file mode 100644 index 00000000..7a2a45be --- /dev/null +++ b/node_modules/readdirp/node_modules/is-number/index.js @@ -0,0 +1,22 @@ +/*! + * is-number + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +module.exports = function isNumber(num) { + var type = typeOf(num); + + if (type === 'string') { + if (!num.trim()) return false; + } else if (type !== 'number') { + return false; + } + + return (num - num + 1) >= 0; +}; diff --git a/node_modules/readdirp/node_modules/is-number/node_modules/kind-of/LICENSE b/node_modules/readdirp/node_modules/is-number/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..d734237b --- /dev/null +++ b/node_modules/readdirp/node_modules/is-number/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/readdirp/node_modules/is-number/node_modules/kind-of/README.md b/node_modules/readdirp/node_modules/is-number/node_modules/kind-of/README.md new file mode 100644 index 00000000..6a9df36d --- /dev/null +++ b/node_modules/readdirp/node_modules/is-number/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/readdirp/node_modules/is-number/node_modules/kind-of/index.js b/node_modules/readdirp/node_modules/is-number/node_modules/kind-of/index.js new file mode 100644 index 00000000..b52c2917 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-number/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/readdirp/node_modules/is-number/node_modules/kind-of/package.json b/node_modules/readdirp/node_modules/is-number/node_modules/kind-of/package.json new file mode 100644 index 00000000..c441f889 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-number/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": "/readdirp/is-number/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": [ + "/readdirp/is-number" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "_shasum": "31ea21a734bab9bbb0f32466d893aea51e4a3c64", + "_spec": "kind-of@^3.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/is-number", + "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/readdirp/node_modules/is-number/package.json b/node_modules/readdirp/node_modules/is-number/package.json new file mode 100644 index 00000000..b0bc7b16 --- /dev/null +++ b/node_modules/readdirp/node_modules/is-number/package.json @@ -0,0 +1,123 @@ +{ + "_from": "is-number@^3.0.0", + "_id": "is-number@3.0.0", + "_inBundle": false, + "_integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "_location": "/readdirp/is-number", + "_phantomChildren": { + "is-buffer": "1.1.6" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-number@^3.0.0", + "name": "is-number", + "escapedName": "is-number", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/readdirp/fill-range" + ], + "_resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "_shasum": "24fd6201a4782cf50561c810276afc7d12d71195", + "_spec": "is-number@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/fill-range", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-number/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Charlike Mike Reagent", + "url": "http://www.tunnckocore.tk" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Returns true if the value is a number. comprehensive tests.", + "devDependencies": { + "benchmarked": "^0.2.5", + "chalk": "^1.1.3", + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-number", + "keywords": [ + "check", + "coerce", + "coercion", + "integer", + "is", + "is-nan", + "is-num", + "is-number", + "istype", + "kind", + "math", + "nan", + "num", + "number", + "numeric", + "test", + "type", + "typeof", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-number", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-number.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "even", + "is-even", + "is-odd", + "is-primitive", + "kind-of", + "odd" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ] + }, + "version": "3.0.0" +} diff --git a/node_modules/readdirp/node_modules/isobject/LICENSE b/node_modules/readdirp/node_modules/isobject/LICENSE new file mode 100644 index 00000000..943e71d0 --- /dev/null +++ b/node_modules/readdirp/node_modules/isobject/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/readdirp/node_modules/isobject/README.md b/node_modules/readdirp/node_modules/isobject/README.md new file mode 100644 index 00000000..d01feaa4 --- /dev/null +++ b/node_modules/readdirp/node_modules/isobject/README.md @@ -0,0 +1,122 @@ +# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM monthly downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![NPM total downloads](https://img.shields.io/npm/dt/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat&label=Travis)](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 --save isobject +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add isobject +``` + +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](https://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); +``` + +## 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.") +* [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 "Returns true if an object was created by the `Object` constructor.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") +* [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.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 29 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [magnudae](https://github.com/magnudae) | +| 1 | [LeSuisse](https://github.com/LeSuisse) | +| 1 | [tmcw](https://github.com/tmcw) | + +### 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 30, 2017._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/isobject/index.d.ts b/node_modules/readdirp/node_modules/isobject/index.d.ts new file mode 100644 index 00000000..55f81c27 --- /dev/null +++ b/node_modules/readdirp/node_modules/isobject/index.d.ts @@ -0,0 +1,5 @@ +export = isObject; + +declare function isObject(val: any): boolean; + +declare namespace isObject {} diff --git a/node_modules/readdirp/node_modules/isobject/index.js b/node_modules/readdirp/node_modules/isobject/index.js new file mode 100644 index 00000000..2d59958b --- /dev/null +++ b/node_modules/readdirp/node_modules/isobject/index.js @@ -0,0 +1,12 @@ +/*! + * isobject + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function isObject(val) { + return val != null && typeof val === 'object' && Array.isArray(val) === false; +}; diff --git a/node_modules/readdirp/node_modules/isobject/package.json b/node_modules/readdirp/node_modules/isobject/package.json new file mode 100644 index 00000000..adb48c4f --- /dev/null +++ b/node_modules/readdirp/node_modules/isobject/package.json @@ -0,0 +1,119 @@ +{ + "_from": "isobject@^3.0.1", + "_id": "isobject@3.0.1", + "_inBundle": false, + "_integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "_location": "/readdirp/isobject", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "isobject@^3.0.1", + "name": "isobject", + "escapedName": "isobject", + "rawSpec": "^3.0.1", + "saveSpec": null, + "fetchSpec": "^3.0.1" + }, + "_requiredBy": [ + "/readdirp/braces" + ], + "_resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "_shasum": "4e431e92b11a9731636aa1f9c8d1ccbcfdab78df", + "_spec": "isobject@^3.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/braces", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/isobject/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "url": "https://github.com/LeSuisse" + }, + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Magnús Dæhlen", + "url": "https://github.com/magnudae" + }, + { + "name": "Tom MacWright", + "url": "https://macwright.org" + } + ], + "dependencies": {}, + "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.d.ts", + "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" + }, + "types": "index.d.ts", + "verb": { + "related": { + "list": [ + "extend-shallow", + "is-plain-object", + "kind-of", + "merge-deep" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "3.0.1" +} diff --git a/node_modules/readdirp/node_modules/kind-of/CHANGELOG.md b/node_modules/readdirp/node_modules/kind-of/CHANGELOG.md new file mode 100644 index 00000000..01687d5c --- /dev/null +++ b/node_modules/readdirp/node_modules/kind-of/CHANGELOG.md @@ -0,0 +1,160 @@ +# 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.3] - 2020-01-16 + +- Merge pull request #31 for issue #30 + +## [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 \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/kind-of/LICENSE b/node_modules/readdirp/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/readdirp/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/readdirp/node_modules/kind-of/README.md b/node_modules/readdirp/node_modules/kind-of/README.md new file mode 100644 index 00000000..0411dc58 --- /dev/null +++ b/node_modules/readdirp/node_modules/kind-of/README.md @@ -0,0 +1,367 @@ +# 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/micromatch/is-glob) | [homepage](https://github.com/micromatch/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 a number or string value is a finite number. Useful for regex… [more](https://github.com/jonschlinkert/is-number) | [homepage](https://github.com/jonschlinkert/is-number "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.") +* [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** | +| --- | --- | +| 102 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [doowb](https://github.com/doowb) | +| 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 | [tunnckoCore](https://github.com/tunnckoCore) | +| 1 | [xiaofen9](https://github.com/xiaofen9) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2020, [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.8.0, on January 16, 2020._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/kind-of/index.js b/node_modules/readdirp/node_modules/kind-of/index.js new file mode 100644 index 00000000..dfa799b7 --- /dev/null +++ b/node_modules/readdirp/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 typeof val.constructor === 'function' ? 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/readdirp/node_modules/kind-of/package.json b/node_modules/readdirp/node_modules/kind-of/package.json new file mode 100644 index 00000000..c9407fd0 --- /dev/null +++ b/node_modules/readdirp/node_modules/kind-of/package.json @@ -0,0 +1,146 @@ +{ + "_from": "kind-of@^6.0.2", + "_id": "kind-of@6.0.3", + "_inBundle": false, + "_integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "_location": "/readdirp/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": [ + "/readdirp/is-accessor-descriptor", + "/readdirp/is-data-descriptor", + "/readdirp/is-descriptor", + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "_shasum": "07c05034a6c349fa06e24fa35aa76db4580ce4dd", + "_spec": "kind-of@^6.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/node_modules/micromatch", + "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.3" +} diff --git a/node_modules/readdirp/node_modules/micromatch/CHANGELOG.md b/node_modules/readdirp/node_modules/micromatch/CHANGELOG.md new file mode 100644 index 00000000..9d8e5ed0 --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/CHANGELOG.md @@ -0,0 +1,37 @@ +## History + +### key + +Changelog entries are classified using the following labels _(from [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 +- `bumped`: updated dependencies, only minor or higher will be listed. + +### [3.0.0] - 2017-04-11 + +TODO. There should be no breaking changes. Please report any regressions. I will [reformat these release notes](https://github.com/micromatch/micromatch/pull/76) and add them to the changelog as soon as I have a chance. + +### [1.0.1] - 2016-12-12 + +**Added** + +- Support for windows path edge cases where backslashes are used in brackets or other unusual combinations. + +### [1.0.0] - 2016-12-12 + +Stable release. + +### [0.1.0] - 2016-10-08 + +First release. + + +[Unreleased]: https://github.com/jonschlinkert/micromatch/compare/0.1.0...HEAD +[0.2.0]: https://github.com/jonschlinkert/micromatch/compare/0.1.0...0.2.0 + +[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog + diff --git a/node_modules/readdirp/node_modules/micromatch/LICENSE b/node_modules/readdirp/node_modules/micromatch/LICENSE new file mode 100755 index 00000000..d32ab442 --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/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/readdirp/node_modules/micromatch/README.md b/node_modules/readdirp/node_modules/micromatch/README.md new file mode 100644 index 00000000..5dfa1498 --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/README.md @@ -0,0 +1,1150 @@ +# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![NPM total downloads](https://img.shields.io/npm/dt/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Linux Build Status](https://img.shields.io/travis/micromatch/micromatch.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/micromatch) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/micromatch.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/micromatch) + +> Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Table of Contents + +
+Details + +- [Install](#install) +- [Quickstart](#quickstart) +- [Why use micromatch?](#why-use-micromatch) + * [Matching features](#matching-features) +- [Switching to micromatch](#switching-to-micromatch) + * [From minimatch](#from-minimatch) + * [From multimatch](#from-multimatch) +- [API](#api) +- [Options](#options) + * [options.basename](#optionsbasename) + * [options.bash](#optionsbash) + * [options.cache](#optionscache) + * [options.dot](#optionsdot) + * [options.failglob](#optionsfailglob) + * [options.ignore](#optionsignore) + * [options.matchBase](#optionsmatchbase) + * [options.nobrace](#optionsnobrace) + * [options.nocase](#optionsnocase) + * [options.nodupes](#optionsnodupes) + * [options.noext](#optionsnoext) + * [options.nonegate](#optionsnonegate) + * [options.noglobstar](#optionsnoglobstar) + * [options.nonull](#optionsnonull) + * [options.nullglob](#optionsnullglob) + * [options.snapdragon](#optionssnapdragon) + * [options.sourcemap](#optionssourcemap) + * [options.unescape](#optionsunescape) + * [options.unixify](#optionsunixify) +- [Extended globbing](#extended-globbing) + * [extglobs](#extglobs) + * [braces](#braces) + * [regex character classes](#regex-character-classes) + * [regex groups](#regex-groups) + * [POSIX bracket expressions](#posix-bracket-expressions) +- [Notes](#notes) + * [Bash 4.3 parity](#bash-43-parity) + * [Backslashes](#backslashes) +- [Contributing](#contributing) +- [Benchmarks](#benchmarks) + * [Running benchmarks](#running-benchmarks) + * [Latest results](#latest-results) +- [About](#about) + +
+ +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save micromatch +``` + +## Quickstart + +```js +var mm = require('micromatch'); +mm(list, patterns[, options]); +``` + +The [main export](#micromatch) takes a list of strings and one or more glob patterns: + +```js +console.log(mm(['foo', 'bar', 'qux'], ['f*', 'b*'])); +//=> ['foo', 'bar'] +``` + +Use [.isMatch()](#ismatch) to get true/false: + +```js +console.log(mm.isMatch('foo', 'f*')); +//=> true +``` + +[Switching](#switching-to-micromatch) from minimatch and multimatch is easy! + +## Why use micromatch? + +> micromatch is a [drop-in replacement](#switching-to-micromatch) for minimatch and multimatch + +* Supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch) +* Micromatch uses [snapdragon](https://github.com/jonschlinkert/snapdragon) for parsing and compiling globs, which provides granular control over the entire conversion process in a way that is easy to understand, reason about, and maintain. +* More consistently accurate matching [than minimatch](https://github.com/yarnpkg/yarn/pull/3339), with more than 36,000 [test assertions](./test) to prove it. +* More complete support for the Bash 4.3 specification than minimatch and multimatch. In fact, micromatch passes _all of the spec tests_ from bash, including some that bash still fails. +* [Faster matching](#benchmarks), from a combination of optimized glob patterns, faster algorithms, and regex caching. +* [Micromatch is safer](https://github.com/micromatch/braces#braces-is-safe), and is not subject to DoS with brace patterns, like minimatch and multimatch. +* More reliable windows support than minimatch and multimatch. + +### Matching features + +* Support for multiple glob patterns (no need for wrappers like multimatch) +* Wildcards (`**`, `*.js`) +* Negation (`'!a/*.js'`, `'*!(b).js']`) +* [extglobs](https://github.com/micromatch/extglob) (`+(x|y)`, `!(a|b)`) +* [POSIX character classes](https://github.com/micromatch/expand-brackets) (`[[:alpha:][:digit:]]`) +* [brace expansion](https://github.com/micromatch/braces) (`foo/{1..5}.md`, `bar/{a,b,c}.js`) +* regex character classes (`foo-[1-5].js`) +* regex logical "or" (`foo/(abc|xyz).js`) + +You can mix and match these features to create whatever patterns you need! + +## Switching to micromatch + +There is one notable difference between micromatch and minimatch in regards to how backslashes are handled. See [the notes about backslashes](#backslashes) for more information. + +### From minimatch + +Use [mm.isMatch()](#ismatch) instead of `minimatch()`: + +```js +mm.isMatch('foo', 'b*'); +//=> false +``` + +Use [mm.match()](#match) instead of `minimatch.match()`: + +```js +mm.match(['foo', 'bar'], 'b*'); +//=> 'bar' +``` + +### From multimatch + +Same signature: + +```js +mm(['foo', 'bar', 'baz'], ['f*', '*z']); +//=> ['foo', 'baz'] +``` + +## API + +### [micromatch](index.js#L41) + +The main function takes a list of strings and one or more glob patterns to use for matching. + +**Params** + +* `list` **{Array}**: A list of strings to match +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Array}**: Returns an array of matches + +**Example** + +```js +var mm = require('micromatch'); +mm(list, patterns[, options]); + +console.log(mm(['a.js', 'a.txt'], ['*.js'])); +//=> [ 'a.js' ] +``` + +### [.match](index.js#L93) + +Similar to the main function, but `pattern` must be a string. + +**Params** + +* `list` **{Array}**: Array of strings to match +* `pattern` **{String}**: Glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Array}**: Returns an array of matches + +**Example** + +```js +var mm = require('micromatch'); +mm.match(list, pattern[, options]); + +console.log(mm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a')); +//=> ['a.a', 'a.aa'] +``` + +### [.isMatch](index.js#L154) + +Returns true if the specified `string` matches the given glob `pattern`. + +**Params** + +* `string` **{String}**: String to match +* `pattern` **{String}**: Glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if the string matches the glob pattern. + +**Example** + +```js +var mm = require('micromatch'); +mm.isMatch(string, pattern[, options]); + +console.log(mm.isMatch('a.a', '*.a')); +//=> true +console.log(mm.isMatch('a.b', '*.a')); +//=> false +``` + +### [.some](index.js#L192) + +Returns true if some of the strings in the given `list` match any of the given glob `patterns`. + +**Params** + +* `list` **{String|Array}**: The string or array of strings to test. Returns as soon as the first match is found. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +var mm = require('micromatch'); +mm.some(list, patterns[, options]); + +console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); +// true +console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); +// false +``` + +### [.every](index.js#L228) + +Returns true if every string in the given `list` matches any of the given glob `patterns`. + +**Params** + +* `list` **{String|Array}**: The string or array of strings to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +var mm = require('micromatch'); +mm.every(list, patterns[, options]); + +console.log(mm.every('foo.js', ['foo.js'])); +// true +console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); +// true +console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); +// false +console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); +// false +``` + +### [.any](index.js#L260) + +Returns true if **any** of the given glob `patterns` match the specified `string`. + +**Params** + +* `str` **{String|Array}**: The string to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +var mm = require('micromatch'); +mm.any(string, patterns[, options]); + +console.log(mm.any('a.a', ['b.*', '*.a'])); +//=> true +console.log(mm.any('a.a', 'b.*')); +//=> false +``` + +### [.all](index.js#L308) + +Returns true if **all** of the given `patterns` match the specified string. + +**Params** + +* `str` **{String|Array}**: The string to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +var mm = require('micromatch'); +mm.all(string, patterns[, options]); + +console.log(mm.all('foo.js', ['foo.js'])); +// true + +console.log(mm.all('foo.js', ['*.js', '!foo.js'])); +// false + +console.log(mm.all('foo.js', ['*.js', 'foo.js'])); +// true + +console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); +// true +``` + +### [.not](index.js#L340) + +Returns a list of strings that _**do not match any**_ of the given `patterns`. + +**Params** + +* `list` **{Array}**: Array of strings to match. +* `patterns` **{String|Array}**: One or more glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Array}**: Returns an array of strings that **do not match** the given patterns. + +**Example** + +```js +var mm = require('micromatch'); +mm.not(list, patterns[, options]); + +console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); +//=> ['b.b', 'c.c'] +``` + +### [.contains](index.js#L376) + +Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string. + +**Params** + +* `str` **{String}**: The string to match. +* `patterns` **{String|Array}**: Glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if the patter matches any part of `str`. + +**Example** + +```js +var mm = require('micromatch'); +mm.contains(string, pattern[, options]); + +console.log(mm.contains('aa/bb/cc', '*b')); +//=> true +console.log(mm.contains('aa/bb/cc', '*d')); +//=> false +``` + +### [.matchKeys](index.js#L432) + +Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead. + +**Params** + +* `object` **{Object}**: The object with keys to filter. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Object}**: Returns an object with only keys that match the given patterns. + +**Example** + +```js +var mm = require('micromatch'); +mm.matchKeys(object, patterns[, options]); + +var obj = { aa: 'a', ab: 'b', ac: 'c' }; +console.log(mm.matchKeys(obj, '*b')); +//=> { ab: 'b' } +``` + +### [.matcher](index.js#L461) + +Returns a memoized matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match. + +**Params** + +* `pattern` **{String}**: Glob pattern +* `options` **{Object}**: See available [options](#options) for changing how matches are performed. +* `returns` **{Function}**: Returns a matcher function. + +**Example** + +```js +var mm = require('micromatch'); +mm.matcher(pattern[, options]); + +var isMatch = mm.matcher('*.!(*a)'); +console.log(isMatch('a.a')); +//=> false +console.log(isMatch('a.b')); +//=> true +``` + +### [.capture](index.js#L536) + +Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match. + +**Params** + +* `pattern` **{String}**: Glob pattern to use for matching. +* `string` **{String}**: String to match +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns an array of captures if the string matches the glob pattern, otherwise `null`. + +**Example** + +```js +var mm = require('micromatch'); +mm.capture(pattern, string[, options]); + +console.log(mm.capture('test/*.js', 'test/foo.js')); +//=> ['foo'] +console.log(mm.capture('test/*.js', 'foo/bar.css')); +//=> null +``` + +### [.makeRe](index.js#L571) + +Create a regular expression from the given glob `pattern`. + +**Params** + +* `pattern` **{String}**: A glob pattern to convert to regex. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed. +* `returns` **{RegExp}**: Returns a regex created from the given pattern. + +**Example** + +```js +var mm = require('micromatch'); +mm.makeRe(pattern[, options]); + +console.log(mm.makeRe('*.js')); +//=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ +``` + +### [.braces](index.js#L618) + +Expand the given brace `pattern`. + +**Params** + +* `pattern` **{String}**: String with brace pattern to expand. +* `options` **{Object}**: Any [options](#options) to change how expansion is performed. See the [braces](https://github.com/micromatch/braces) library for all available options. +* `returns` **{Array}** + +**Example** + +```js +var mm = require('micromatch'); +console.log(mm.braces('foo/{a,b}/bar')); +//=> ['foo/(a|b)/bar'] + +console.log(mm.braces('foo/{a,b}/bar', {expand: true})); +//=> ['foo/(a|b)/bar'] +``` + +### [.create](index.js#L685) + +Parses the given glob `pattern` and returns an array of abstract syntax trees (ASTs), with the compiled `output` and optional source `map` on each AST. + +**Params** + +* `pattern` **{String}**: Glob pattern to parse and compile. +* `options` **{Object}**: Any [options](#options) to change how parsing and compiling is performed. +* `returns` **{Object}**: Returns an object with the parsed AST, compiled string and optional source map. + +**Example** + +```js +var mm = require('micromatch'); +mm.create(pattern[, options]); + +console.log(mm.create('abc/*.js')); +// [{ options: { source: 'string', sourcemap: true }, +// state: {}, +// compilers: +// { ... }, +// output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js', +// ast: +// { type: 'root', +// errors: [], +// nodes: +// [ ... ], +// dot: false, +// input: 'abc/*.js' }, +// parsingErrors: [], +// map: +// { version: 3, +// sources: [ 'string' ], +// names: [], +// mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE', +// sourcesContent: [ 'abc/*.js' ] }, +// position: { line: 1, column: 28 }, +// content: {}, +// files: {}, +// idx: 6 }] +``` + +### [.parse](index.js#L732) + +Parse the given `str` with the given `options`. + +**Params** + +* `str` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an AST + +**Example** + +```js +var mm = require('micromatch'); +mm.parse(pattern[, options]); + +var ast = mm.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: '' } ] } +``` + +### [.compile](index.js#L780) + +Compile the given `ast` or string with the given `options`. + +**Params** + +* `ast` **{Object|String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object that has an `output` property with the compiled string. + +**Example** + +```js +var mm = require('micromatch'); +mm.compile(ast[, options]); + +var ast = mm.parse('a/{b,c}/d'); +console.log(mm.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: [] } +``` + +### [.clearCache](index.js#L801) + +Clear the regex cache. + +**Example** + +```js +mm.clearCache(); +``` + +## Options + +* [basename](#optionsbasename) +* [bash](#optionsbash) +* [cache](#optionscache) +* [dot](#optionsdot) +* [failglob](#optionsfailglob) +* [ignore](#optionsignore) +* [matchBase](#optionsmatchBase) +* [nobrace](#optionsnobrace) +* [nocase](#optionsnocase) +* [nodupes](#optionsnodupes) +* [noext](#optionsnoext) +* [noglobstar](#optionsnoglobstar) +* [nonull](#optionsnonull) +* [nullglob](#optionsnullglob) +* [snapdragon](#optionssnapdragon) +* [sourcemap](#optionssourcemap) +* [unescape](#optionsunescape) +* [unixify](#optionsunixify) + +### options.basename + +Allow glob patterns without slashes to match a file path based on its basename. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `matchBase`. + +**Type**: `Boolean` + +**Default**: `false` + +**Example** + +```js +mm(['a/b.js', 'a/c.md'], '*.js'); +//=> [] + +mm(['a/b.js', 'a/c.md'], '*.js', {matchBase: true}); +//=> ['a/b.js'] +``` + +### options.bash + +Enabled by default, this option enforces bash-like behavior with stars immediately following a bracket expression. Bash bracket expressions are similar to regex character classes, but unlike regex, a star following a bracket expression **does not repeat the bracketed characters**. Instead, the star is treated the same as an other star. + +**Type**: `Boolean` + +**Default**: `true` + +**Example** + +```js +var files = ['abc', 'ajz']; +console.log(mm(files, '[a-c]*')); +//=> ['abc', 'ajz'] + +console.log(mm(files, '[a-c]*', {bash: false})); +``` + +### options.cache + +Disable regex and function memoization. + +**Type**: `Boolean` + +**Default**: `undefined` + +### options.dot + +Match dotfiles. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `dot`. + +**Type**: `Boolean` + +**Default**: `false` + +### options.failglob + +Similar to the `--failglob` behavior in Bash, throws an error when no matches are found. + +**Type**: `Boolean` + +**Default**: `undefined` + +### options.ignore + +String or array of glob patterns to match files to ignore. + +**Type**: `String|Array` + +**Default**: `undefined` + +### options.matchBase + +Alias for [options.basename](#options-basename). + +### options.nobrace + +Disable expansion of brace patterns. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nobrace`. + +**Type**: `Boolean` + +**Default**: `undefined` + +See [braces](https://github.com/micromatch/braces) for more information about extended brace expansion. + +### options.nocase + +Use a case-insensitive regex for matching files. Same behavior as [minimatch](https://github.com/isaacs/minimatch). + +**Type**: `Boolean` + +**Default**: `undefined` + +### options.nodupes + +Remove duplicate elements from the result array. + +**Type**: `Boolean` + +**Default**: `undefined` + +**Example** + +Example of using the `unescape` and `nodupes` options together: + +```js +mm.match(['a/b/c', 'a/b/c'], 'a/b/c'); +//=> ['a/b/c', 'a/b/c'] + +mm.match(['a/b/c', 'a/b/c'], 'a/b/c', {nodupes: true}); +//=> ['abc'] +``` + +### options.noext + +Disable extglob support, so that extglobs are regarded as literal characters. + +**Type**: `Boolean` + +**Default**: `undefined` + +**Examples** + +```js +mm(['a/z', 'a/b', 'a/!(z)'], 'a/!(z)'); +//=> ['a/b', 'a/!(z)'] + +mm(['a/z', 'a/b', 'a/!(z)'], 'a/!(z)', {noext: true}); +//=> ['a/!(z)'] (matches only as literal characters) +``` + +### options.nonegate + +Disallow negation (`!`) patterns, and treat leading `!` as a literal character to match. + +**Type**: `Boolean` + +**Default**: `undefined` + +### options.noglobstar + +Disable matching with globstars (`**`). + +**Type**: `Boolean` + +**Default**: `undefined` + +```js +mm(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**'); +//=> ['a/b', 'a/b/c', 'a/b/c/d'] + +mm(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**', {noglobstar: true}); +//=> ['a/b'] +``` + +### options.nonull + +Alias for [options.nullglob](#options-nullglob). + +### options.nullglob + +If `true`, when no matches are found the actual (arrayified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nonull`. + +**Type**: `Boolean` + +**Default**: `undefined` + +### options.snapdragon + +Pass your own instance of [snapdragon](https://github.com/jonschlinkert/snapdragon), to customize parsers or compilers. + +**Type**: `Object` + +**Default**: `undefined` + +### options.sourcemap + +Generate a source map by enabling the `sourcemap` option with the `.parse`, `.compile`, or `.create` methods. + +_(Note that sourcemaps are currently not enabled for brace patterns)_ + +**Examples** + +``` js +var mm = require('micromatch'); +var pattern = '*(*(of*(a)x)z)'; + +var res = mm.create('abc/*.js', {sourcemap: true}); +console.log(res.map); +// { version: 3, +// sources: [ 'string' ], +// names: [], +// mappings: 'AAAA,GAAG,EAAC,iBAAC,EAAC,EAAE', +// sourcesContent: [ 'abc/*.js' ] } + +var ast = mm.parse('abc/**/*.js'); +var res = mm.compile(ast, {sourcemap: true}); +console.log(res.map); +// { version: 3, +// sources: [ 'string' ], +// names: [], +// mappings: 'AAAA,GAAG,EAAC,2BAAE,EAAC,iBAAC,EAAC,EAAE', +// sourcesContent: [ 'abc/**/*.js' ] } + +var ast = mm.parse(pattern); +var res = mm.compile(ast, {sourcemap: true}); +console.log(res.map); +// { version: 3, +// sources: [ 'string' ], +// names: [], +// mappings: 'AAAA,CAAE,CAAE,EAAE,CAAE,CAAC,EAAC,CAAC,EAAC,CAAC,EAAC', +// sourcesContent: [ '*(*(of*(a)x)z)' ] } +``` + +### options.unescape + +Remove backslashes from returned matches. + +**Type**: `Boolean` + +**Default**: `undefined` + +**Example** + +In this example we want to match a literal `*`: + +```js +mm.match(['abc', 'a\\*c'], 'a\\*c'); +//=> ['a\\*c'] + +mm.match(['abc', 'a\\*c'], 'a\\*c', {unescape: true}); +//=> ['a*c'] +``` + +### options.unixify + +Convert path separators on returned files to posix/unix-style forward slashes. + +**Type**: `Boolean` + +**Default**: `true` on windows, `false` everywhere else + +**Example** + +```js +mm.match(['a\\b\\c'], 'a/**'); +//=> ['a/b/c'] + +mm.match(['a\\b\\c'], {unixify: false}); +//=> ['a\\b\\c'] +``` + +## Extended globbing + +Micromatch also supports extended globbing features. + +### extglobs + +Extended globbing, as described by the bash man page: + +| **pattern** | **regex equivalent** | **description** | +| --- | --- | --- | +| `?(pattern)` | `(pattern)?` | Matches zero or one occurrence of the given patterns | +| `*(pattern)` | `(pattern)*` | Matches zero or more occurrences of the given patterns | +| `+(pattern)` | `(pattern)+` | Matches one or more occurrences of the given patterns | +| `@(pattern)` | `(pattern)` * | Matches one of the given patterns | +| `!(pattern)` | N/A (equivalent regex is much more complicated) | Matches anything except one of the given patterns | + +* Note that `@` isn't a RegEx character. + +Powered by [extglob](https://github.com/micromatch/extglob). Visit that library for the full range of options or to report extglob related issues. + +### braces + +Brace patterns can be used to match specific ranges or sets of characters. 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 +``` + +Visit [braces](https://github.com/micromatch/braces) to see the full range of features and options related to brace expansion, or to create brace matching or expansion related issues. + +### regex character classes + +Given the list: `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: + +* `[ac].js`: matches both `a` and `c`, returning `['a.js', 'c.js']` +* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']` +* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']` +* `a/[A-Z].js`: matches and uppercase letter, returning `['a/E.md']` + +Learn about [regex character classes](http://www.regular-expressions.info/charclass.html). + +### regex groups + +Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: + +* `(a|c).js`: would match either `a` or `c`, returning `['a.js', 'c.js']` +* `(b|d).js`: would match either `b` or `d`, returning `['b.js', 'd.js']` +* `(b|[A-Z]).js`: would match either `b` or an uppercase letter, returning `['b.js', 'E.js']` + +As with regex, parens can be nested, so patterns like `((a|b)|c)/b` will work. Although brace expansion might be friendlier to use, depending on preference. + +### POSIX bracket expressions + +POSIX brackets are intended to be more user-friendly than regex character classes. This of course is in the eye of the beholder. + +**Example** + +```js +mm.isMatch('a1', '[[:alpha:][:digit:]]'); +//=> true + +mm.isMatch('a1', '[[:alpha:][:alpha:]]'); +//=> false +``` + +See [expand-brackets](https://github.com/jonschlinkert/expand-brackets) for more information about bracket expressions. + +*** + +## Notes + +### Bash 4.3 parity + +Whenever possible matching behavior is based on behavior Bash 4.3, which is mostly consistent with minimatch. + +However, it's suprising how many edge cases and rabbit holes there are with glob matching, and since there is no real glob specification, and micromatch is more accurate than both Bash and minimatch, there are cases where best-guesses were made for behavior. In a few cases where Bash had no answers, we used wildmatch (used by git) as a fallback. + +### Backslashes + +There is an important, notable difference between minimatch and micromatch _in regards to how backslashes are handled_ in glob patterns. + +* Micromatch exclusively and explicitly reserves backslashes for escaping characters in a glob pattern, even on windows. This is consistent with bash behavior. +* Minimatch converts all backslashes to forward slashes, which means you can't use backslashes to escape any characters in your glob patterns. + +We made this decision for micromatch for a couple of reasons: + +* consistency with bash conventions. +* glob patterns are not filepaths. They are a type of [regular language](https://en.wikipedia.org/wiki/Regular_language) that is converted to a JavaScript regular expression. Thus, when forward slashes are defined in a glob pattern, the resulting regular expression will match windows or POSIX path separators just fine. + +**A note about joining paths to globs** + +Note that when you pass something like `path.join('foo', '*')` to micromatch, you are creating a filepath and expecting it to still work as a glob pattern. This causes problems on windows, since the `path.sep` is `\\`. + +In other words, since `\\` is reserved as an escape character in globs, on windows `path.join('foo', '*')` would result in `foo\\*`, which tells micromatch to match `*` as a literal character. This is the same behavior as bash. + +## Contributing + +All contributions are welcome! Please read [the contributing guide](.github/contributing.md) to get started. + +**Bug reports** + +Please create an issue if you encounter a bug or matching behavior that doesn't seem correct. If you find a matching-related issue, please: + +* [research existing issues first](../../issues) (open and closed) +* visit the [GNU Bash documentation](https://www.gnu.org/software/bash/manual/) to see how Bash deals with the pattern +* visit the [minimatch](https://github.com/isaacs/minimatch) documentation to cross-check expected behavior in node.js +* if all else fails, since there is no real specification for globs we will probably need to discuss expected behavior and decide how to resolve it. which means any detail you can provide to help with this discussion would be greatly appreciated. + +**Platform issues** + +It's important to us that micromatch work consistently on all platforms. If you encounter any platform-specific matching or path related issues, please let us know (pull requests are also greatly appreciated). + +## Benchmarks + +### Running benchmarks + +Install dev dependencies: + +```bash +npm i -d && npm run benchmark +``` + +### Latest results + +As of February 18, 2018 (longer bars are better): + +```sh +# braces-globstar-large-list (485691 bytes) + micromatch ██████████████████████████████████████████████████ (517 ops/sec ±0.49%) + minimatch █ (18.92 ops/sec ±0.54%) + multimatch █ (18.94 ops/sec ±0.62%) + + micromatch is faster by an avg. of 2,733% + +# braces-multiple (3362 bytes) + micromatch ██████████████████████████████████████████████████ (33,625 ops/sec ±0.45%) + minimatch (2.92 ops/sec ±3.26%) + multimatch (2.90 ops/sec ±2.76%) + + micromatch is faster by an avg. of 1,156,935% + +# braces-range (727 bytes) + micromatch █████████████████████████████████████████████████ (155,220 ops/sec ±0.56%) + minimatch ██████ (20,186 ops/sec ±1.27%) + multimatch ██████ (19,809 ops/sec ±0.60%) + + micromatch is faster by an avg. of 776% + +# braces-set (2858 bytes) + micromatch █████████████████████████████████████████████████ (24,354 ops/sec ±0.92%) + minimatch █████ (2,566 ops/sec ±0.56%) + multimatch ████ (2,431 ops/sec ±1.25%) + + micromatch is faster by an avg. of 975% + +# globstar-large-list (485686 bytes) + micromatch █████████████████████████████████████████████████ (504 ops/sec ±0.45%) + minimatch ███ (33.36 ops/sec ±1.08%) + multimatch ███ (33.19 ops/sec ±1.35%) + + micromatch is faster by an avg. of 1,514% + +# globstar-long-list (90647 bytes) + micromatch ██████████████████████████████████████████████████ (2,694 ops/sec ±1.08%) + minimatch ████████████████ (870 ops/sec ±1.09%) + multimatch ████████████████ (862 ops/sec ±0.84%) + + micromatch is faster by an avg. of 311% + +# globstar-short-list (182 bytes) + micromatch ██████████████████████████████████████████████████ (328,921 ops/sec ±1.06%) + minimatch █████████ (64,808 ops/sec ±1.42%) + multimatch ████████ (57,991 ops/sec ±2.11%) + + micromatch is faster by an avg. of 536% + +# no-glob (701 bytes) + micromatch █████████████████████████████████████████████████ (415,935 ops/sec ±0.36%) + minimatch ███████████ (92,730 ops/sec ±1.44%) + multimatch █████████ (81,958 ops/sec ±2.13%) + + micromatch is faster by an avg. of 476% + +# star-basename-long (12339 bytes) + micromatch █████████████████████████████████████████████████ (7,963 ops/sec ±0.36%) + minimatch ███████████████████████████████ (5,072 ops/sec ±0.83%) + multimatch ███████████████████████████████ (5,028 ops/sec ±0.40%) + + micromatch is faster by an avg. of 158% + +# star-basename-short (349 bytes) + micromatch ██████████████████████████████████████████████████ (269,552 ops/sec ±0.70%) + minimatch ██████████████████████ (122,457 ops/sec ±1.39%) + multimatch ████████████████████ (110,788 ops/sec ±1.99%) + + micromatch is faster by an avg. of 231% + +# star-folder-long (19207 bytes) + micromatch █████████████████████████████████████████████████ (3,806 ops/sec ±0.38%) + minimatch ████████████████████████████ (2,204 ops/sec ±0.32%) + multimatch ██████████████████████████ (2,020 ops/sec ±1.07%) + + micromatch is faster by an avg. of 180% + +# star-folder-short (551 bytes) + micromatch ██████████████████████████████████████████████████ (249,077 ops/sec ±0.40%) + minimatch ███████████ (59,431 ops/sec ±1.67%) + multimatch ███████████ (55,569 ops/sec ±1.43%) + + micromatch is faster by an avg. of 433% +``` + +## 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. + +
+ +
+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: + +* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… [more](https://github.com/micromatch/braces) | [homepage](https://github.com/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.") +* [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`") +* [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** | +| --- | --- | +| 457 | [jonschlinkert](https://github.com/jonschlinkert) | +| 12 | [es128](https://github.com/es128) | +| 8 | [doowb](https://github.com/doowb) | +| 3 | [paulmillr](https://github.com/paulmillr) | +| 2 | [TrySound](https://github.com/TrySound) | +| 2 | [MartinKolarik](https://github.com/MartinKolarik) | +| 2 | [charlike-old](https://github.com/charlike-old) | +| 1 | [amilajack](https://github.com/amilajack) | +| 1 | [mrmlnc](https://github.com/mrmlnc) | +| 1 | [devongovett](https://github.com/devongovett) | +| 1 | [DianeLooney](https://github.com/DianeLooney) | +| 1 | [UltCombo](https://github.com/UltCombo) | +| 1 | [tomByrer](https://github.com/tomByrer) | +| 1 | [fidian](https://github.com/fidian) | + +### 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 18, 2018._ \ No newline at end of file diff --git a/node_modules/readdirp/node_modules/micromatch/index.js b/node_modules/readdirp/node_modules/micromatch/index.js new file mode 100644 index 00000000..fe02f2cb --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/index.js @@ -0,0 +1,877 @@ +'use strict'; + +/** + * Module dependencies + */ + +var util = require('util'); +var braces = require('braces'); +var toRegex = require('to-regex'); +var extend = require('extend-shallow'); + +/** + * Local dependencies + */ + +var compilers = require('./lib/compilers'); +var parsers = require('./lib/parsers'); +var cache = require('./lib/cache'); +var utils = require('./lib/utils'); +var MAX_LENGTH = 1024 * 64; + +/** + * The main function takes a list of strings and one or more + * glob patterns to use for matching. + * + * ```js + * var mm = require('micromatch'); + * mm(list, patterns[, options]); + * + * console.log(mm(['a.js', 'a.txt'], ['*.js'])); + * //=> [ 'a.js' ] + * ``` + * @param {Array} `list` A list of strings to match + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of matches + * @summary false + * @api public + */ + +function micromatch(list, patterns, options) { + patterns = utils.arrayify(patterns); + list = utils.arrayify(list); + + var len = patterns.length; + if (list.length === 0 || len === 0) { + return []; + } + + if (len === 1) { + return micromatch.match(list, patterns[0], options); + } + + var omit = []; + var keep = []; + var idx = -1; + + while (++idx < len) { + var pattern = patterns[idx]; + + if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33 /* ! */) { + omit.push.apply(omit, micromatch.match(list, pattern.slice(1), options)); + } else { + keep.push.apply(keep, micromatch.match(list, pattern, options)); + } + } + + var matches = utils.diff(keep, omit); + if (!options || options.nodupes !== false) { + return utils.unique(matches); + } + + return matches; +} + +/** + * Similar to the main function, but `pattern` must be a string. + * + * ```js + * var mm = require('micromatch'); + * mm.match(list, pattern[, options]); + * + * console.log(mm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a')); + * //=> ['a.a', 'a.aa'] + * ``` + * @param {Array} `list` Array of strings to match + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of matches + * @api public + */ + +micromatch.match = function(list, pattern, options) { + if (Array.isArray(pattern)) { + throw new TypeError('expected pattern to be a string'); + } + + var unixify = utils.unixify(options); + var isMatch = memoize('match', pattern, options, micromatch.matcher); + var matches = []; + + list = utils.arrayify(list); + var len = list.length; + var idx = -1; + + while (++idx < len) { + var ele = list[idx]; + if (ele === pattern || isMatch(ele)) { + matches.push(utils.value(ele, unixify, options)); + } + } + + // if no options were passed, uniquify results and return + if (typeof options === 'undefined') { + return utils.unique(matches); + } + + if (matches.length === 0) { + if (options.failglob === true) { + throw new Error('no matches found for "' + pattern + '"'); + } + if (options.nonull === true || options.nullglob === true) { + return [options.unescape ? utils.unescape(pattern) : pattern]; + } + } + + // if `opts.ignore` was defined, diff ignored list + if (options.ignore) { + matches = micromatch.not(matches, options.ignore, options); + } + + return options.nodupes !== false ? utils.unique(matches) : matches; +}; + +/** + * Returns true if the specified `string` matches the given glob `pattern`. + * + * ```js + * var mm = require('micromatch'); + * mm.isMatch(string, pattern[, options]); + * + * console.log(mm.isMatch('a.a', '*.a')); + * //=> true + * console.log(mm.isMatch('a.b', '*.a')); + * //=> false + * ``` + * @param {String} `string` String to match + * @param {String} `pattern` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the string matches the glob pattern. + * @api public + */ + +micromatch.isMatch = function(str, pattern, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (isEmptyString(str) || isEmptyString(pattern)) { + return false; + } + + var equals = utils.equalsPattern(options); + if (equals(str)) { + return true; + } + + var isMatch = memoize('isMatch', pattern, options, micromatch.matcher); + return isMatch(str); +}; + +/** + * Returns true if some of the strings in the given `list` match any of the + * given glob `patterns`. + * + * ```js + * var mm = require('micromatch'); + * mm.some(list, patterns[, options]); + * + * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // true + * console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.some = function(list, patterns, options) { + if (typeof list === 'string') { + list = [list]; + } + for (var i = 0; i < list.length; i++) { + if (micromatch(list[i], patterns, options).length === 1) { + return true; + } + } + return false; +}; + +/** + * Returns true if every string in the given `list` matches + * any of the given glob `patterns`. + * + * ```js + * var mm = require('micromatch'); + * mm.every(list, patterns[, options]); + * + * console.log(mm.every('foo.js', ['foo.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // false + * console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.every = function(list, patterns, options) { + if (typeof list === 'string') { + list = [list]; + } + for (var i = 0; i < list.length; i++) { + if (micromatch(list[i], patterns, options).length !== 1) { + return false; + } + } + return true; +}; + +/** + * Returns true if **any** of the given glob `patterns` + * match the specified `string`. + * + * ```js + * var mm = require('micromatch'); + * mm.any(string, patterns[, options]); + * + * console.log(mm.any('a.a', ['b.*', '*.a'])); + * //=> true + * console.log(mm.any('a.a', 'b.*')); + * //=> false + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.any = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (isEmptyString(str) || isEmptyString(patterns)) { + return false; + } + + if (typeof patterns === 'string') { + patterns = [patterns]; + } + + for (var i = 0; i < patterns.length; i++) { + if (micromatch.isMatch(str, patterns[i], options)) { + return true; + } + } + return false; +}; + +/** + * Returns true if **all** of the given `patterns` match + * the specified string. + * + * ```js + * var mm = require('micromatch'); + * mm.all(string, patterns[, options]); + * + * console.log(mm.all('foo.js', ['foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', '!foo.js'])); + * // false + * + * console.log(mm.all('foo.js', ['*.js', 'foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); + * // true + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.all = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + if (typeof patterns === 'string') { + patterns = [patterns]; + } + for (var i = 0; i < patterns.length; i++) { + if (!micromatch.isMatch(str, patterns[i], options)) { + return false; + } + } + return true; +}; + +/** + * Returns a list of strings that _**do not match any**_ of the given `patterns`. + * + * ```js + * var mm = require('micromatch'); + * mm.not(list, patterns[, options]); + * + * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); + * //=> ['b.b', 'c.c'] + * ``` + * @param {Array} `list` Array of strings to match. + * @param {String|Array} `patterns` One or more glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of strings that **do not match** the given patterns. + * @api public + */ + +micromatch.not = function(list, patterns, options) { + var opts = extend({}, options); + var ignore = opts.ignore; + delete opts.ignore; + + var unixify = utils.unixify(opts); + list = utils.arrayify(list).map(unixify); + + var matches = utils.diff(list, micromatch(list, patterns, opts)); + if (ignore) { + matches = utils.diff(matches, micromatch(list, ignore)); + } + + return opts.nodupes !== false ? utils.unique(matches) : matches; +}; + +/** + * Returns true if the given `string` contains the given pattern. Similar + * to [.isMatch](#isMatch) but the pattern can match any part of the string. + * + * ```js + * var mm = require('micromatch'); + * mm.contains(string, pattern[, options]); + * + * console.log(mm.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(mm.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String|Array} `patterns` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if the patter matches any part of `str`. + * @api public + */ + +micromatch.contains = function(str, patterns, options) { + if (typeof str !== 'string') { + throw new TypeError('expected a string: "' + util.inspect(str) + '"'); + } + + if (typeof patterns === 'string') { + if (isEmptyString(str) || isEmptyString(patterns)) { + return false; + } + + var equals = utils.equalsPattern(patterns, options); + if (equals(str)) { + return true; + } + var contains = utils.containsPattern(patterns, options); + if (contains(str)) { + return true; + } + } + + var opts = extend({}, options, {contains: true}); + return micromatch.any(str, patterns, opts); +}; + +/** + * Returns true if the given pattern and options should enable + * the `matchBase` option. + * @return {Boolean} + * @api private + */ + +micromatch.matchBase = function(pattern, options) { + if (pattern && pattern.indexOf('/') !== -1 || !options) return false; + return options.basename === true || options.matchBase === true; +}; + +/** + * Filter the keys of the given object with the given `glob` pattern + * and `options`. Does not attempt to match nested keys. If you need this feature, + * use [glob-object][] instead. + * + * ```js + * var mm = require('micromatch'); + * mm.matchKeys(object, patterns[, options]); + * + * var obj = { aa: 'a', ab: 'b', ac: 'c' }; + * console.log(mm.matchKeys(obj, '*b')); + * //=> { ab: 'b' } + * ``` + * @param {Object} `object` The object with keys to filter. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Object} Returns an object with only keys that match the given patterns. + * @api public + */ + +micromatch.matchKeys = function(obj, patterns, options) { + if (!utils.isObject(obj)) { + throw new TypeError('expected the first argument to be an object'); + } + var keys = micromatch(Object.keys(obj), patterns, options); + return utils.pick(obj, keys); +}; + +/** + * Returns a memoized matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns + * true if the string is a match. + * + * ```js + * var mm = require('micromatch'); + * mm.matcher(pattern[, options]); + * + * var isMatch = mm.matcher('*.!(*a)'); + * console.log(isMatch('a.a')); + * //=> false + * console.log(isMatch('a.b')); + * //=> true + * ``` + * @param {String} `pattern` Glob pattern + * @param {Object} `options` See available [options](#options) for changing how matches are performed. + * @return {Function} Returns a matcher function. + * @api public + */ + +micromatch.matcher = function matcher(pattern, options) { + if (Array.isArray(pattern)) { + return compose(pattern, options, matcher); + } + + // if pattern is a regex + if (pattern instanceof RegExp) { + return test(pattern); + } + + // if pattern is invalid + if (!utils.isString(pattern)) { + throw new TypeError('expected pattern to be an array, string or regex'); + } + + // if pattern is a non-glob string + if (!utils.hasSpecialChars(pattern)) { + if (options && options.nocase === true) { + pattern = pattern.toLowerCase(); + } + return utils.matchPath(pattern, options); + } + + // if pattern is a glob string + var re = micromatch.makeRe(pattern, options); + + // if `options.matchBase` or `options.basename` is defined + if (micromatch.matchBase(pattern, options)) { + return utils.matchBasename(re, options); + } + + function test(regex) { + var equals = utils.equalsPattern(options); + var unixify = utils.unixify(options); + + return function(str) { + if (equals(str)) { + return true; + } + + if (regex.test(unixify(str))) { + return true; + } + return false; + }; + } + + var fn = test(re); + Object.defineProperty(fn, 'result', { + configurable: true, + enumerable: false, + value: re.result + }); + return fn; +}; + +/** + * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match. + * + * ```js + * var mm = require('micromatch'); + * mm.capture(pattern, string[, options]); + * + * console.log(mm.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(mm.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `pattern` Glob pattern to use for matching. + * @param {String} `string` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`. + * @api public + */ + +micromatch.capture = function(pattern, str, options) { + var re = micromatch.makeRe(pattern, extend({capture: true}, options)); + var unixify = utils.unixify(options); + + function match() { + return function(string) { + var match = re.exec(unixify(string)); + if (!match) { + return null; + } + + return match.slice(1); + }; + } + + var capture = memoize('capture', pattern, options, match); + return capture(str); +}; + +/** + * Create a regular expression from the given glob `pattern`. + * + * ```js + * var mm = require('micromatch'); + * mm.makeRe(pattern[, options]); + * + * console.log(mm.makeRe('*.js')); + * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ + * ``` + * @param {String} `pattern` A glob pattern to convert to regex. + * @param {Object} `options` See available [options](#options) for changing how matches are performed. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +micromatch.makeRe = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected pattern to be a string'); + } + + if (pattern.length > MAX_LENGTH) { + throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters'); + } + + function makeRe() { + var result = micromatch.create(pattern, options); + var ast_array = []; + var output = result.map(function(obj) { + obj.ast.state = obj.state; + ast_array.push(obj.ast); + return obj.output; + }); + + var regex = toRegex(output.join('|'), options); + Object.defineProperty(regex, 'result', { + configurable: true, + enumerable: false, + value: ast_array + }); + return regex; + } + + return memoize('makeRe', pattern, options, makeRe); +}; + +/** + * Expand the given brace `pattern`. + * + * ```js + * var mm = require('micromatch'); + * console.log(mm.braces('foo/{a,b}/bar')); + * //=> ['foo/(a|b)/bar'] + * + * console.log(mm.braces('foo/{a,b}/bar', {expand: true})); + * //=> ['foo/(a|b)/bar'] + * ``` + * @param {String} `pattern` String with brace pattern to expand. + * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options. + * @return {Array} + * @api public + */ + +micromatch.braces = function(pattern, options) { + if (typeof pattern !== 'string' && !Array.isArray(pattern)) { + throw new TypeError('expected pattern to be an array or string'); + } + + function expand() { + if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) { + return utils.arrayify(pattern); + } + return braces(pattern, options); + } + + return memoize('braces', pattern, options, expand); +}; + +/** + * Proxy to the [micromatch.braces](#method), for parity with + * minimatch. + */ + +micromatch.braceExpand = function(pattern, options) { + var opts = extend({}, options, {expand: true}); + return micromatch.braces(pattern, opts); +}; + +/** + * Parses the given glob `pattern` and returns an array of abstract syntax + * trees (ASTs), with the compiled `output` and optional source `map` on + * each AST. + * + * ```js + * var mm = require('micromatch'); + * mm.create(pattern[, options]); + * + * console.log(mm.create('abc/*.js')); + * // [{ options: { source: 'string', sourcemap: true }, + * // state: {}, + * // compilers: + * // { ... }, + * // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js', + * // ast: + * // { type: 'root', + * // errors: [], + * // nodes: + * // [ ... ], + * // dot: false, + * // input: 'abc/*.js' }, + * // parsingErrors: [], + * // map: + * // { version: 3, + * // sources: [ 'string' ], + * // names: [], + * // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE', + * // sourcesContent: [ 'abc/*.js' ] }, + * // position: { line: 1, column: 28 }, + * // content: {}, + * // files: {}, + * // idx: 6 }] + * ``` + * @param {String} `pattern` Glob pattern to parse and compile. + * @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed. + * @return {Object} Returns an object with the parsed AST, compiled string and optional source map. + * @api public + */ + +micromatch.create = function(pattern, options) { + return memoize('create', pattern, options, function() { + function create(str, opts) { + return micromatch.compile(micromatch.parse(str, opts), opts); + } + + pattern = micromatch.braces(pattern, options); + var len = pattern.length; + var idx = -1; + var res = []; + + while (++idx < len) { + res.push(create(pattern[idx], options)); + } + return res; + }); +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * var mm = require('micromatch'); + * mm.parse(pattern[, options]); + * + * var ast = mm.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} `str` + * @param {Object} `options` + * @return {Object} Returns an AST + * @api public + */ + +micromatch.parse = function(pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('expected a string'); + } + + function parse() { + var snapdragon = utils.instantiate(null, options); + parsers(snapdragon, options); + + var ast = snapdragon.parse(pattern, options); + utils.define(ast, 'snapdragon', snapdragon); + ast.input = pattern; + return ast; + } + + return memoize('parse', pattern, options, parse); +}; + +/** + * Compile the given `ast` or string with the given `options`. + * + * ```js + * var mm = require('micromatch'); + * mm.compile(ast[, options]); + * + * var ast = mm.parse('a/{b,c}/d'); + * console.log(mm.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` + * @param {Object} `options` + * @return {Object} Returns an object that has an `output` property with the compiled string. + * @api public + */ + +micromatch.compile = function(ast, options) { + if (typeof ast === 'string') { + ast = micromatch.parse(ast, options); + } + + return memoize('compile', ast.input, options, function() { + var snapdragon = utils.instantiate(ast, options); + compilers(snapdragon, options); + return snapdragon.compile(ast, options); + }); +}; + +/** + * Clear the regex cache. + * + * ```js + * mm.clearCache(); + * ``` + * @api public + */ + +micromatch.clearCache = function() { + micromatch.cache.caches = {}; +}; + +/** + * Returns true if the given value is effectively an empty string + */ + +function isEmptyString(val) { + return String(val) === '' || String(val) === './'; +} + +/** + * Compose a matcher function with the given patterns. + * This allows matcher functions to be compiled once and + * called multiple times. + */ + +function compose(patterns, options, matcher) { + var matchers; + + return memoize('compose', String(patterns), options, function() { + return function(file) { + // delay composition until it's invoked the first time, + // after that it won't be called again + if (!matchers) { + matchers = []; + for (var i = 0; i < patterns.length; i++) { + matchers.push(matcher(patterns[i], options)); + } + } + + var len = matchers.length; + while (len--) { + if (matchers[len](file) === true) { + return true; + } + } + return false; + }; + }); +} + +/** + * Memoize a generated regex or function. A unique key is generated + * from the `type` (usually method name), the `pattern`, and + * user-defined options. + */ + +function memoize(type, pattern, options, fn) { + var key = utils.createKey(type + '=' + pattern, options); + + if (options && options.cache === false) { + return fn(pattern, options); + } + + if (cache.has(type, key)) { + return cache.get(type, key); + } + + var val = fn(pattern, options); + cache.set(type, key, val); + return val; +} + +/** + * Expose compiler, parser and cache on `micromatch` + */ + +micromatch.compilers = compilers; +micromatch.parsers = parsers; +micromatch.caches = cache.caches; + +/** + * Expose `micromatch` + * @type {Function} + */ + +module.exports = micromatch; diff --git a/node_modules/readdirp/node_modules/micromatch/lib/cache.js b/node_modules/readdirp/node_modules/micromatch/lib/cache.js new file mode 100644 index 00000000..fffc4c17 --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/lib/cache.js @@ -0,0 +1 @@ +module.exports = new (require('fragment-cache'))(); diff --git a/node_modules/readdirp/node_modules/micromatch/lib/compilers.js b/node_modules/readdirp/node_modules/micromatch/lib/compilers.js new file mode 100644 index 00000000..85cda4f8 --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/lib/compilers.js @@ -0,0 +1,77 @@ +'use strict'; + +var nanomatch = require('nanomatch'); +var extglob = require('extglob'); + +module.exports = function(snapdragon) { + var compilers = snapdragon.compiler.compilers; + var opts = snapdragon.options; + + // register nanomatch compilers + snapdragon.use(nanomatch.compilers); + + // get references to some specific nanomatch compilers before they + // are overridden by the extglob and/or custom compilers + var escape = compilers.escape; + var qmark = compilers.qmark; + var slash = compilers.slash; + var star = compilers.star; + var text = compilers.text; + var plus = compilers.plus; + var dot = compilers.dot; + + // register extglob compilers or escape exglobs if disabled + if (opts.extglob === false || opts.noext === true) { + snapdragon.compiler.use(escapeExtglobs); + } else { + snapdragon.use(extglob.compilers); + } + + snapdragon.use(function() { + this.options.star = this.options.star || function(/*node*/) { + return '[^\\\\/]*?'; + }; + }); + + // custom micromatch compilers + snapdragon.compiler + + // reset referenced compiler + .set('dot', dot) + .set('escape', escape) + .set('plus', plus) + .set('slash', slash) + .set('qmark', qmark) + .set('star', star) + .set('text', text); +}; + +function escapeExtglobs(compiler) { + compiler.set('paren', function(node) { + var val = ''; + visit(node, function(tok) { + if (tok.val) val += (/^\W/.test(tok.val) ? '\\' : '') + tok.val; + }); + return this.emit(val, node); + }); + + /** + * Visit `node` with the given `fn` + */ + + function visit(node, fn) { + return node.nodes ? mapVisit(node.nodes, fn) : fn(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); + } + } +} diff --git a/node_modules/readdirp/node_modules/micromatch/lib/parsers.js b/node_modules/readdirp/node_modules/micromatch/lib/parsers.js new file mode 100644 index 00000000..f80498ce --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/lib/parsers.js @@ -0,0 +1,83 @@ +'use strict'; + +var extglob = require('extglob'); +var nanomatch = require('nanomatch'); +var regexNot = require('regex-not'); +var toRegex = require('to-regex'); +var not; + +/** + * Characters to use in negation regex (we want to "not" match + * characters that are matched by other parsers) + */ + +var TEXT = '([!@*?+]?\\(|\\)|\\[:?(?=.*?:?\\])|:?\\]|[*+?!^$.\\\\/])+'; +var createNotRegex = function(opts) { + return not || (not = textRegex(TEXT)); +}; + +/** + * Parsers + */ + +module.exports = function(snapdragon) { + var parsers = snapdragon.parser.parsers; + + // register nanomatch parsers + snapdragon.use(nanomatch.parsers); + + // get references to some specific nanomatch parsers before they + // are overridden by the extglob and/or parsers + var escape = parsers.escape; + var slash = parsers.slash; + var qmark = parsers.qmark; + var plus = parsers.plus; + var star = parsers.star; + var dot = parsers.dot; + + // register extglob parsers + snapdragon.use(extglob.parsers); + + // custom micromatch parsers + snapdragon.parser + .use(function() { + // override "notRegex" created in nanomatch parser + this.notRegex = /^\!+(?!\()/; + }) + // reset the referenced parsers + .capture('escape', escape) + .capture('slash', slash) + .capture('qmark', qmark) + .capture('star', star) + .capture('plus', plus) + .capture('dot', dot) + + /** + * Override `text` parser + */ + + .capture('text', function() { + if (this.isInside('bracket')) return; + var pos = this.position(); + var m = this.match(createNotRegex(this.options)); + if (!m || !m[0]) return; + + // escape regex boundary characters and simple brackets + var val = m[0].replace(/([[\]^$])/g, '\\$1'); + + return pos({ + type: 'text', + val: val + }); + }); +}; + +/** + * Create text regex + */ + +function textRegex(pattern) { + var notStr = regexNot.create(pattern, {contains: true, strictClose: false}); + var prefix = '(?:[\\^]|\\\\|'; + return toRegex(prefix + notStr + ')', {strictClose: false}); +} diff --git a/node_modules/readdirp/node_modules/micromatch/lib/utils.js b/node_modules/readdirp/node_modules/micromatch/lib/utils.js new file mode 100644 index 00000000..f0ba9177 --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/lib/utils.js @@ -0,0 +1,309 @@ +'use strict'; + +var utils = module.exports; +var path = require('path'); + +/** + * Module dependencies + */ + +var Snapdragon = require('snapdragon'); +utils.define = require('define-property'); +utils.diff = require('arr-diff'); +utils.extend = require('extend-shallow'); +utils.pick = require('object.pick'); +utils.typeOf = require('kind-of'); +utils.unique = require('array-unique'); + +/** + * Returns true if the platform is windows, or `path.sep` is `\\`. + * This is defined as a function to allow `path.sep` to be set in unit tests, + * or by the user, if there is a reason to do so. + * @return {Boolean} + */ + +utils.isWindows = function() { + return path.sep === '\\' || process.platform === 'win32'; +}; + +/** + * Get the `Snapdragon` instance to use + */ + +utils.instantiate = function(ast, options) { + var snapdragon; + // if an instance was created by `.parse`, use that instance + if (utils.typeOf(ast) === 'object' && ast.snapdragon) { + snapdragon = ast.snapdragon; + // if the user supplies an instance on options, use that instance + } else if (utils.typeOf(options) === 'object' && options.snapdragon) { + snapdragon = options.snapdragon; + // create a new instance + } else { + snapdragon = new Snapdragon(options); + } + + utils.define(snapdragon, 'parse', function(str, options) { + var parsed = Snapdragon.prototype.parse.apply(this, arguments); + parsed.input = str; + + // escape unmatched brace/bracket/parens + var last = this.parser.stack.pop(); + if (last && this.options.strictErrors !== true) { + var open = last.nodes[0]; + var inner = last.nodes[1]; + if (last.type === 'bracket') { + if (inner.val.charAt(0) === '[') { + inner.val = '\\' + inner.val; + } + + } else { + open.val = '\\' + open.val; + var sibling = open.parent.nodes[1]; + if (sibling.type === 'star') { + sibling.loose = true; + } + } + } + + // add non-enumerable parser reference + utils.define(parsed, 'parser', this.parser); + return parsed; + }); + + return snapdragon; +}; + +/** + * 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. + */ + +utils.createKey = function(pattern, options) { + if (utils.typeOf(options) !== 'object') { + return pattern; + } + var val = pattern; + var keys = Object.keys(options); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + val += ';' + key + '=' + String(options[key]); + } + return val; +}; + +/** + * Cast `val` to an array + * @return {Array} + */ + +utils.arrayify = function(val) { + if (typeof val === 'string') return [val]; + return val ? (Array.isArray(val) ? val : [val]) : []; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isString = function(val) { + return typeof val === 'string'; +}; + +/** + * Return true if `val` is a non-empty string + */ + +utils.isObject = function(val) { + return utils.typeOf(val) === 'object'; +}; + +/** + * Returns true if the given `str` has special characters + */ + +utils.hasSpecialChars = function(str) { + return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str); +}; + +/** + * Escape regex characters in the given string + */ + +utils.escapeRegex = function(str) { + return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&'); +}; + +/** + * Normalize slashes in the given filepath. + * + * @param {String} `filepath` + * @return {String} + */ + +utils.toPosixPath = function(str) { + return str.replace(/\\+/g, '/'); +}; + +/** + * Strip backslashes before special characters in a string. + * + * @param {String} `str` + * @return {String} + */ + +utils.unescape = function(str) { + return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, '')); +}; + +/** + * Strip the prefix from a filepath + * @param {String} `fp` + * @return {String} + */ + +utils.stripPrefix = function(str) { + if (str.charAt(0) !== '.') { + return str; + } + var ch = str.charAt(1); + if (utils.isSlash(ch)) { + return str.slice(2); + } + return str; +}; + +/** + * Returns true if the given str is an escaped or + * unescaped path character + */ + +utils.isSlash = function(str) { + return str === '/' || str === '\\/' || str === '\\' || str === '\\\\'; +}; + +/** + * Returns a function that returns true if the given + * pattern matches or contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.matchPath = function(pattern, options) { + return (options && options.contains) + ? utils.containsPattern(pattern, options) + : utils.equalsPattern(pattern, options); +}; + +/** + * Returns true if the given (original) filepath or unixified path are equal + * to the given pattern. + */ + +utils._equals = function(filepath, unixPath, pattern) { + return pattern === filepath || pattern === unixPath; +}; + +/** + * Returns true if the given (original) filepath or unixified path contain + * the given pattern. + */ + +utils._contains = function(filepath, unixPath, pattern) { + return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1; +}; + +/** + * Returns a function that returns true if the given + * pattern is the same as a given `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.equalsPattern = function(pattern, options) { + var unixify = utils.unixify(options); + options = options || {}; + + return function fn(filepath) { + var equal = utils._equals(filepath, unixify(filepath), pattern); + if (equal === true || options.nocase !== true) { + return equal; + } + var lower = filepath.toLowerCase(); + return utils._equals(lower, unixify(lower), pattern); + }; +}; + +/** + * Returns a function that returns true if the given + * pattern contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.containsPattern = function(pattern, options) { + var unixify = utils.unixify(options); + options = options || {}; + + return function(filepath) { + var contains = utils._contains(filepath, unixify(filepath), pattern); + if (contains === true || options.nocase !== true) { + return contains; + } + var lower = filepath.toLowerCase(); + return utils._contains(lower, unixify(lower), pattern); + }; +}; + +/** + * Returns a function that returns true if the given + * regex matches the `filename` of a file path. + * + * @param {RegExp} `re` Matching regex + * @return {Function} + */ + +utils.matchBasename = function(re) { + return function(filepath) { + return re.test(path.basename(filepath)); + }; +}; + +/** + * Determines the filepath to return based on the provided options. + * @return {any} + */ + +utils.value = function(str, unixify, options) { + if (options && options.unixify === false) { + return str; + } + return unixify(str); +}; + +/** + * Returns a function that normalizes slashes in a string to forward + * slashes, strips `./` from beginning of paths, and optionally unescapes + * special characters. + * @return {Function} + */ + +utils.unixify = function(options) { + options = options || {}; + return function(filepath) { + if (utils.isWindows() || options.unixify === true) { + filepath = utils.toPosixPath(filepath); + } + if (options.stripPrefix !== false) { + filepath = utils.stripPrefix(filepath); + } + if (options.unescape === true) { + filepath = utils.unescape(filepath); + } + return filepath; + }; +}; diff --git a/node_modules/readdirp/node_modules/micromatch/package.json b/node_modules/readdirp/node_modules/micromatch/package.json new file mode 100644 index 00000000..54e452ef --- /dev/null +++ b/node_modules/readdirp/node_modules/micromatch/package.json @@ -0,0 +1,216 @@ +{ + "_from": "micromatch@^3.1.10", + "_id": "micromatch@3.1.10", + "_inBundle": false, + "_integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "_location": "/readdirp/micromatch", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "micromatch@^3.1.10", + "name": "micromatch", + "escapedName": "micromatch", + "rawSpec": "^3.1.10", + "saveSpec": null, + "fetchSpec": "^3.1.10" + }, + "_requiredBy": [ + "/readdirp" + ], + "_resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "_shasum": "70859bc95c9840952f359a068a3fc49f9ecfac23", + "_spec": "micromatch@^3.1.10", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/micromatch/micromatch/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Amila Welihinda", + "url": "amilajack.com" + }, + { + "name": "Bogdan Chadkin", + "url": "https://github.com/TrySound" + }, + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Devon Govett", + "url": "http://badassjs.com" + }, + { + "name": "Elan Shanker", + "url": "https://github.com/es128" + }, + { + "name": "Fabrício Matté", + "url": "https://ultcombo.js.org" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Martin Kolárik", + "url": "https://kolarik.sk" + }, + { + "name": "Olsten Larck", + "url": "https://i.am.charlike.online" + }, + { + "name": "Paul Miller", + "url": "paulmillr.com" + }, + { + "name": "Tom Byrer", + "url": "https://github.com/tomByrer" + }, + { + "name": "Tyler Akins", + "url": "http://rumkin.com" + }, + { + "url": "https://github.com/DianeLooney" + } + ], + "dependencies": { + "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.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "deprecated": false, + "description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.", + "devDependencies": { + "bash-match": "^1.0.2", + "for-own": "^1.0.0", + "gulp": "^3.9.1", + "gulp-format-md": "^1.0.0", + "gulp-istanbul": "^1.1.3", + "gulp-mocha": "^5.0.0", + "gulp-unused": "^0.2.1", + "is-windows": "^1.0.2", + "minimatch": "^3.0.4", + "minimist": "^1.2.0", + "mocha": "^3.5.3", + "multimatch": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/micromatch/micromatch", + "keywords": [ + "bash", + "expand", + "expansion", + "expression", + "file", + "files", + "filter", + "find", + "glob", + "globbing", + "globs", + "globstar", + "match", + "matcher", + "matches", + "matching", + "micromatch", + "minimatch", + "multimatch", + "path", + "pattern", + "patterns", + "regex", + "regexp", + "regular", + "shell", + "wildcard" + ], + "license": "MIT", + "lintDeps": { + "dependencies": { + "options": { + "lock": { + "snapdragon": "^0.8.1" + } + } + }, + "devDependencies": { + "files": { + "options": { + "ignore": [ + "benchmark/**" + ] + } + } + } + }, + "main": "index.js", + "name": "micromatch", + "repository": { + "type": "git", + "url": "git+https://github.com/micromatch/micromatch.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": "collapsible", + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "helpers": [ + "./benchmark/helper.js" + ], + "related": { + "list": [ + "braces", + "expand-brackets", + "extglob", + "fill-range", + "nanomatch" + ] + }, + "lint": { + "reflinks": true + }, + "reflinks": [ + "expand-brackets", + "extglob", + "glob-object", + "minimatch", + "multimatch", + "snapdragon" + ] + }, + "version": "3.1.10" +} diff --git a/node_modules/readdirp/package.json b/node_modules/readdirp/package.json new file mode 100644 index 00000000..6f9fe468 --- /dev/null +++ b/node_modules/readdirp/package.json @@ -0,0 +1,101 @@ +{ + "_from": "readdirp@^2.0.0", + "_id": "readdirp@2.2.1", + "_inBundle": false, + "_integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "_location": "/readdirp", + "_phantomChildren": { + "arr-flatten": "1.1.0", + "debug": "2.6.9", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "fragment-cache": "0.2.1", + "is-buffer": "1.1.6", + "is-extendable": "0.1.1", + "nanomatch": "1.2.13", + "object.pick": "1.3.0", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "repeat-element": "1.1.3", + "repeat-string": "1.6.1", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2", + "to-regex-range": "2.1.1" + }, + "_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.2.1.tgz", + "_shasum": "0e87622a3325aa33e892285caf8b4e846529a525", + "_spec": "readdirp@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/chokidar", + "author": { + "name": "Thorsten Lorenz", + "email": "thlorenz@gmx.de", + "url": "thlorenz.com" + }, + "bugs": { + "url": "https://github.com/paulmillr/readdirp/issues" + }, + "bundleDependencies": false, + "dependencies": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + }, + "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.10" + }, + "files": [ + "readdirp.js", + "stream-api.js" + ], + "homepage": "https://github.com/paulmillr/readdirp", + "keywords": [ + "recursive", + "fs", + "stream", + "streams", + "readdir", + "filesystem", + "find", + "filter" + ], + "license": "MIT", + "main": "readdirp.js", + "name": "readdirp", + "repository": { + "type": "git", + "url": "git://github.com/paulmillr/readdirp.git" + }, + "scripts": { + "test": "npm run test-main", + "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.2.1" +} diff --git a/node_modules/readdirp/readdirp.js b/node_modules/readdirp/readdirp.js new file mode 100644 index 00000000..863bd17b --- /dev/null +++ b/node_modules/readdirp/readdirp.js @@ -0,0 +1,294 @@ +'use strict'; + +var fs = require('graceful-fs') + , path = require('path') + , micromatch = require('micromatch').isMatch + , toString = Object.prototype.toString + ; + + +// Standard helpers +function isFunction (obj) { + return toString.call(obj) === '[object Function]'; +} + +function isString (obj) { + return toString.call(obj) === '[object String]'; +} + +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 + , 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/paulmillr/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/paulmillr/readdirp#filters' + ); + } + } + } + + // Turn all filters into a function + if (isFunction(filter)) { + + return filter; + + } else if (isString(filter)) { + + return function (entryInfo) { + return micromatch(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 micromatch(entryInfo.name, f); + }); + } + : + // use OR to concat multiple inclusive filters + function (entryInfo) { + return filter.some(function (f) { + return micromatch(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) { + setImmediate(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 00000000..bffd1a97 --- /dev/null +++ b/node_modules/readdirp/stream-api.js @@ -0,0 +1,98 @@ +'use strict'; + +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; + setImmediate(function () { + if (self._paused) return self._warnings.push(err); + if (!self._destroyed) self.emit('warn', err); + }); +} + +proto._handleFatalError = function (err) { + var self = this; + setImmediate(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/regex-cache/LICENSE b/node_modules/regex-cache/LICENSE new file mode 100644 index 00000000..c0d7f136 --- /dev/null +++ b/node_modules/regex-cache/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/regex-cache/README.md b/node_modules/regex-cache/README.md new file mode 100644 index 00000000..8c660147 --- /dev/null +++ b/node_modules/regex-cache/README.md @@ -0,0 +1,166 @@ +# regex-cache [![NPM version](https://img.shields.io/npm/v/regex-cache.svg?style=flat)](https://www.npmjs.com/package/regex-cache) [![NPM monthly downloads](https://img.shields.io/npm/dm/regex-cache.svg?style=flat)](https://npmjs.org/package/regex-cache) [![NPM total downloads](https://img.shields.io/npm/dt/regex-cache.svg?style=flat)](https://npmjs.org/package/regex-cache) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/regex-cache.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/regex-cache) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/regex-cache.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/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. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save regex-cache +``` + +* Read [what this does](#what-this-does). +* See [the benchmarks](#benchmarks) + +## Usage + +Wrap a function like this: + +```js +var cache = require('regex-cache'); +var someRegex = cache(require('some-regex-lib')); +``` + +**Caching a regex** + +If you want to cache a regex after calling `new RegExp()`, or you're requiring a module that returns a regex, wrap it with a function first: + +```js +var cache = require('regex-cache'); + +function yourRegex(str, opts) { + // do stuff to str and opts + return new RegExp(str, opts.flags); +} + +var regex = cache(yourRegex); +``` + +## Recommendations + +### Use this when... + +* **No options are passed** to the function that creates the regex. Regardless of how big or small the regex is, when zero options are passed, caching will be faster than not. +* **A few options are passed**, and the values are primitives. The limited benchmarks I did show that caching is beneficial when up to 8 or 9 options are passed. + +### Do not use this when... + +* **The values of options are not primitives**. When non-primitives must be compared for equality, the time to compare the options is most likely as long or longer than the time to just create a new regex. + +### Example benchmarks + +Performance results, with and without regex-cache: + +```bash +# no args passed (defaults) + with-cache x 8,699,231 ops/sec ±0.86% (93 runs sampled) + without-cache x 2,777,551 ops/sec ±0.63% (95 runs sampled) + +# string and six options passed + with-cache x 1,885,934 ops/sec ±0.80% (93 runs sampled) + without-cache x 1,256,893 ops/sec ±0.65% (97 runs sampled) + +# string only + with-cache x 7,723,256 ops/sec ±0.87% (92 runs sampled) + without-cache x 2,303,060 ops/sec ±0.47% (99 runs sampled) + +# one option passed + with-cache x 4,179,877 ops/sec ±0.53% (100 runs sampled) + without-cache x 2,198,422 ops/sec ±0.47% (95 runs sampled) + +# two options passed + with-cache x 3,256,222 ops/sec ±0.51% (99 runs sampled) + without-cache x 2,121,401 ops/sec ±0.79% (97 runs sampled) + +# six options passed + with-cache x 1,816,018 ops/sec ±1.08% (96 runs sampled) + without-cache x 1,157,176 ops/sec ±0.53% (100 runs sampled) + +# +# diminishing returns happen about here +# + +# ten options passed + with-cache x 1,210,598 ops/sec ±0.56% (92 runs sampled) + without-cache x 1,665,588 ops/sec ±1.07% (100 runs sampled) + +# twelve options passed + with-cache x 1,042,096 ops/sec ±0.68% (92 runs sampled) + without-cache x 1,389,414 ops/sec ±0.68% (97 runs sampled) + +# twenty options passed + with-cache x 661,125 ops/sec ±0.80% (93 runs sampled) + without-cache x 1,208,757 ops/sec ±0.65% (97 runs sampled) + +# +# when non-primitive values are compared +# + +# single value on the options is an object + with-cache x 1,398,313 ops/sec ±1.05% (95 runs sampled) + without-cache x 2,228,281 ops/sec ±0.56% (99 runs sampled) +``` + +## Run benchmarks + +Install dev dependencies: + +```bash +npm i -d && npm run benchmarks +``` + +## What this does + +If you're using `new RegExp('foo')` instead of a regex literal, it's probably because you need to dyamically generate a regex based on user options or some other potentially changing factors. + +When your function creates a string based on user inputs and passes it to the `RegExp` constructor, regex-cache caches the results. The next time the function is called if the key of a cached regex matches the user input (or no input was given), the cached regex is returned, avoiding unnecessary runtime compilation. + +Using the RegExp constructor offers a lot of flexibility, but the runtime compilation comes at a price - it's slow. Not specifically because of the call to the RegExp constructor, but **because you have to build up the string before `new RegExp()` is even called**. + +## About + +### 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 | [MartinKolarik](https://github.com/MartinKolarik) | + +### 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 September 01, 2017._ \ No newline at end of file diff --git a/node_modules/regex-cache/index.js b/node_modules/regex-cache/index.js new file mode 100644 index 00000000..df8c4231 --- /dev/null +++ b/node_modules/regex-cache/index.js @@ -0,0 +1,68 @@ +/*! + * regex-cache + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var equal = require('is-equal-shallow'); +var basic = {}; +var cache = {}; + +/** + * Expose `regexCache` + */ + +module.exports = regexCache; + +/** + * Memoize the results of a call to the new RegExp constructor. + * + * @param {Function} fn [description] + * @param {String} str [description] + * @param {Options} options [description] + * @param {Boolean} nocompare [description] + * @return {RegExp} + */ + +function regexCache(fn, str, opts) { + var key = '_default_', regex, cached; + + if (!str && !opts) { + if (typeof fn !== 'function') { + return fn; + } + return basic[key] || (basic[key] = fn(str)); + } + + var isString = typeof str === 'string'; + if (isString) { + if (!opts) { + return basic[str] || (basic[str] = fn(str)); + } + key = str; + } else { + opts = str; + } + + cached = cache[key]; + if (cached && equal(cached.opts, opts)) { + return cached.regex; + } + + memo(key, opts, (regex = fn(str, opts))); + return regex; +} + +function memo(key, opts, regex) { + cache[key] = {regex: regex, opts: opts}; +} + +/** + * Expose `cache` + */ + +module.exports.cache = cache; +module.exports.basic = basic; diff --git a/node_modules/regex-cache/package.json b/node_modules/regex-cache/package.json new file mode 100644 index 00000000..a9632e99 --- /dev/null +++ b/node_modules/regex-cache/package.json @@ -0,0 +1,101 @@ +{ + "_from": "regex-cache@^0.4.2", + "_id": "regex-cache@0.4.4", + "_inBundle": false, + "_integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "_location": "/regex-cache", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "regex-cache@^0.4.2", + "name": "regex-cache", + "escapedName": "regex-cache", + "rawSpec": "^0.4.2", + "saveSpec": null, + "fetchSpec": "^0.4.2" + }, + "_requiredBy": [ + "/micromatch" + ], + "_resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "_shasum": "75bdc58a2a1496cec48a12835bc54c8d562336dd", + "_spec": "regex-cache@^0.4.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/micromatch", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/regex-cache/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Martin Kolárik", + "url": "https://kolarik.sk" + } + ], + "dependencies": { + "is-equal-shallow": "^0.1.3" + }, + "deprecated": false, + "description": "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.", + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^0.1.5", + "gulp-format-md": "^0.1.7", + "micromatch": "^2.3.7", + "should": "^8.3.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/regex-cache", + "keywords": [ + "cache", + "expression", + "regex", + "regexp", + "regular", + "regular expression", + "store", + "to-regex" + ], + "license": "MIT", + "main": "index.js", + "name": "regex-cache", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/regex-cache.git" + }, + "scripts": { + "benchmarks": "node benchmark", + "test": "mocha" + }, + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + }, + "version": "0.4.4" +} diff --git a/node_modules/regex-not/LICENSE b/node_modules/regex-not/LICENSE new file mode 100644 index 00000000..8ee09d91 --- /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 00000000..24d00e7d --- /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 00000000..02bfed4a --- /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 00000000..9c6bf9ab --- /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": [ + "/nanomatch", + "/readdirp/expand-brackets", + "/readdirp/extglob", + "/readdirp/micromatch", + "/to-regex" + ], + "_resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "_shasum": "1f4ece27e00b0b65e0247a6810e6a85d83a5752c", + "_spec": "regex-not@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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/remark-cli/cli.js b/node_modules/remark-cli/cli.js new file mode 100755 index 00000000..fb4ac4ae --- /dev/null +++ b/node_modules/remark-cli/cli.js @@ -0,0 +1,24 @@ +#!/usr/bin/env node +'use strict'; + +var start = require('unified-args'); +var extensions = require('markdown-extensions'); +var processor = require('remark'); +var proc = require('remark/package.json'); +var cli = require('./package.json'); + +start({ + processor: processor, + name: proc.name, + description: cli.description, + version: [ + proc.name + ': ' + proc.version, + cli.name + ': ' + cli.version + ].join(', '), + pluginPrefix: proc.name, + presetPrefix: proc.name + '-preset', + packageField: proc.name + 'Config', + rcName: '.' + proc.name + 'rc', + ignoreName: '.' + proc.name + 'ignore', + extensions: extensions +}); diff --git a/node_modules/remark-cli/package.json b/node_modules/remark-cli/package.json new file mode 100644 index 00000000..4785c723 --- /dev/null +++ b/node_modules/remark-cli/package.json @@ -0,0 +1,71 @@ +{ + "_from": "remark-cli@5.0.0", + "_id": "remark-cli@5.0.0", + "_inBundle": false, + "_integrity": "sha512-+j0tza5XZ/XHfity3mg5GJFezRt5hS+ybC7/LDItmOAA8u8gRgB51B+/m5U3yT6RLlhefdqkMGKZnZMcamnvsQ==", + "_location": "/remark-cli", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "remark-cli@5.0.0", + "name": "remark-cli", + "escapedName": "remark-cli", + "rawSpec": "5.0.0", + "saveSpec": null, + "fetchSpec": "5.0.0" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/remark-cli/-/remark-cli-5.0.0.tgz", + "_shasum": "9feefd06474f3d0ff132df21b5334c546df12ab6", + "_spec": "remark-cli@5.0.0", + "_where": "/home/remi/github/CPP_BIDS", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bin": { + "remark": "cli.js" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "markdown-extensions": "^1.1.0", + "remark": "^9.0.0", + "unified-args": "^5.0.0" + }, + "deprecated": false, + "description": "CLI to process markdown with remark using plugins", + "files": [ + "cli.js" + ], + "homepage": "http://remark.js.org", + "keywords": [ + "markdown", + "remark", + "cli", + "bin" + ], + "license": "MIT", + "name": "remark-cli", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark/tree/master/packages/remark-cli" + }, + "scripts": {}, + "version": "5.0.0", + "xo": false +} diff --git a/node_modules/remark-cli/readme.md b/node_modules/remark-cli/readme.md new file mode 100644 index 00000000..1fc86699 --- /dev/null +++ b/node_modules/remark-cli/readme.md @@ -0,0 +1,112 @@ +# remark-cli [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] + +Command-line interface for [**remark**][remark]. + +* Loads [`remark-` plugins][plugins] +* Searches for [markdown extensions][markdown-extensions] +* Ignores paths found in [`.remarkignore` files][ignore-file] +* Loads configuration from [`.remarkrc`, `.remarkrc.js` files][config-file] +* Uses configuration from [`remarkConfig` fields in `package.json` + files][config-file] + +## Installation + +[npm][]: + +```sh +npm install remark-cli +``` + +## Usage + +```sh +# Add a table of contents to `readme.md` +$ remark readme.md --use toc --output + +# Lint markdown files in the current directory +# according to the markdown style guide. +$ remark . --use preset-lint-markdown-style-guide +``` + +## CLI + +See [**unified-args**][unified-args], which provides the interface, +for more information on all available options. + +```txt +Usage: remark [options] [path | glob ...] + + CLI to process markdown with remark using plugins + +Options: + + -h --help output usage information + -v --version output version number + -o --output [path] specify output location + -r --rc-path specify configuration file + -i --ignore-path specify ignore file + -s --setting specify settings + -e --ext specify extensions + -u --use use plugins + -w --watch watch for changes and reprocess + -q --quiet output only warnings and errors + -S --silent output only errors + -f --frail exit with 1 on warnings + -t --tree specify input and output as syntax tree + --report specify reporter + --file-path specify path to process as + --tree-in specify input as syntax tree + --tree-out output syntax tree + --inspect output formatted syntax tree + --[no-]stdout specify writing to stdout (on by default) + --[no-]color specify color in report (on by default) + --[no-]config search for configuration files (on by default) + --[no-]ignore search for ignore files (on by default) + +Examples: + + # Process `input.md` + $ remark input.md -o output.md + + # Pipe + $ remark < input.md > output.md + + # Rewrite all applicable files + $ remark . -o +``` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/remarkjs/remark.svg + +[build-status]: https://travis-ci.org/remarkjs/remark + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg + +[coverage-status]: https://codecov.io/github/remarkjs/remark + +[chat-badge]: https://img.shields.io/gitter/room/remarkjs/Lobby.svg + +[chat]: https://gitter.im/remarkjs/Lobby + +[license]: https://github.com/remarkjs/remark/blob/master/LICENSE + +[author]: http://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[remark]: https://github.com/remarkjs/remark + +[plugins]: https://github.com/remarkjs/remark/blob/master/doc/plugins.md + +[markdown-extensions]: https://github.com/sindresorhus/markdown-extensions + +[config-file]: https://github.com/unifiedjs/unified-engine/blob/master/doc/configure.md + +[ignore-file]: https://github.com/unifiedjs/unified-engine/blob/master/doc/ignore.md + +[unified-args]: https://github.com/unifiedjs/unified-args#cli diff --git a/node_modules/remark-lint-blockquote-indentation/index.js b/node_modules/remark-lint-blockquote-indentation/index.js new file mode 100644 index 00000000..6ff18b37 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/index.js @@ -0,0 +1,107 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module blockquote-indentation + * @fileoverview + * Warn when block quotes are indented too much or too little. + * + * Options: `number` or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used indentation and will warn when + * other block quotes use a different indentation. + * + * @example {"name": "ok.md", "setting": 4} + * + * > Hello + * + * Paragraph. + * + * > World + * + * @example {"name": "ok.md", "setting": 2} + * + * > Hello + * + * Paragraph. + * + * > World + * + * @example {"name": "not-ok.md", "label": "input"} + * + * > Hello + * + * Paragraph. + * + * > World + * + * Paragraph. + * + * > World + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 5:3: Remove 1 space between block quote and content + * 9:3: Add 1 space between block quote and content + */ + +'use strict' + +var rule = require('unified-lint-rule') +var plural = require('pluralize') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') +var toString = require('mdast-util-to-string') + +module.exports = rule( + 'remark-lint:blockquote-indentation', + blockquoteIndentation +) + +function blockquoteIndentation(tree, file, option) { + var preferred = typeof option === 'number' && !isNaN(option) ? option : null + + visit(tree, 'blockquote', visitor) + + function visitor(node) { + var abs + var diff + var reason + + if (generated(node) || node.children.length === 0) { + return + } + + if (preferred) { + diff = preferred - check(node) + + if (diff !== 0) { + abs = Math.abs(diff) + reason = + (diff > 0 ? 'Add' : 'Remove') + + ' ' + + abs + + ' ' + + plural('space', abs) + + ' between block quote and content' + + file.message(reason, position.start(node.children[0])) + } + } else { + preferred = check(node) + } + } +} + +function check(node) { + var head = node.children[0] + var indentation = position.start(head).column - position.start(node).column + var padding = toString(head).match(/^ +/) + + if (padding) { + indentation += padding[0].length + } + + return indentation +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/index.js b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/license b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-blockquote-indentation/node_modules/unist-util-is/package.json b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..8edfbf76 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-blockquote-indentation/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-blockquote-indentation/unist-util-visit", + "/remark-lint-blockquote-indentation/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..6338e8d6 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-blockquote-indentation/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-blockquote-indentation/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/license b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-blockquote-indentation/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..384db46b --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-blockquote-indentation/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-blockquote-indentation" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-blockquote-indentation", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-blockquote-indentation/package.json b/node_modules/remark-lint-blockquote-indentation/package.json new file mode 100644 index 00000000..4d230082 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/package.json @@ -0,0 +1,77 @@ +{ + "_from": "remark-lint-blockquote-indentation@^2.0.0", + "_id": "remark-lint-blockquote-indentation@2.0.1", + "_inBundle": false, + "_integrity": "sha512-uJ9az/Ms9AapnkWpLSCJfawBfnBI2Tn1yUsPNqIFv6YM98ymetItUMyP6ng9NFPqDvTQBbiarulkgoEo0wcafQ==", + "_location": "/remark-lint-blockquote-indentation", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-blockquote-indentation@^2.0.0", + "name": "remark-lint-blockquote-indentation", + "escapedName": "remark-lint-blockquote-indentation", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-2.0.1.tgz", + "_shasum": "27347959acf42a6c3e401488d8210e973576b254", + "_spec": "remark-lint-blockquote-indentation@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-to-string": "^1.0.2", + "pluralize": "^8.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when block quotes are either indented too much or too little", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "blockquote", + "indentation", + "indent" + ], + "license": "MIT", + "name": "remark-lint-blockquote-indentation", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-blockquote-indentation" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-blockquote-indentation/readme.md b/node_modules/remark-lint-blockquote-indentation/readme.md new file mode 100644 index 00000000..bdcbf366 --- /dev/null +++ b/node_modules/remark-lint-blockquote-indentation/readme.md @@ -0,0 +1,187 @@ + + +# remark-lint-blockquote-indentation + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when block quotes are indented too much or too little. + +Options: `number` or `'consistent'`, default: `'consistent'`. + +`'consistent'` detects the first used indentation and will warn when +other block quotes use a different indentation. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `2` | + +## Example + +##### `ok.md` + +When configured with `2`. + +###### In + +```markdown +> Hello + +Paragraph. + +> World +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `4`. + +###### In + +```markdown +> Hello + +Paragraph. + +> World +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +> Hello + +Paragraph. + +> World + +Paragraph. + +> World +``` + +###### Out + +```text +5:3: Remove 1 space between block quote and content +9:3: Add 1 space between block quote and content +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-blockquote-indentation +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-blockquote-indentation", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-blockquote-indentation readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-blockquote-indentation')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-blockquote-indentation.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-blockquote-indentation + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-blockquote-indentation.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-blockquote-indentation + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-checkbox-character-style/index.js b/node_modules/remark-lint-checkbox-character-style/index.js new file mode 100644 index 00000000..9773741b --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/index.js @@ -0,0 +1,159 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module checkbox-character-style + * @fileoverview + * Warn when list item checkboxes violate a given style. + * + * Options: `Object` or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used checked and unchecked checkbox + * styles and warns when subsequent checkboxes use different styles. + * + * Styles can also be passed in like so: + * + * ```js + * {checked: 'x', unchecked: ' '} + * ``` + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats checked checkboxes using `x` (lowercase X) and unchecked checkboxes + * as `·` (a single space). + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": {"checked": "x"}} + * + * - [x] List item + * - [x] List item + * + * @example {"name": "ok.md", "setting": {"checked": "X"}} + * + * - [X] List item + * - [X] List item + * + * @example {"name": "ok.md", "setting": {"unchecked": " "}} + * + * - [ ] List item + * - [ ] List item + * - [ ]·· + * - [ ] + * + * @example {"name": "ok.md", "setting": {"unchecked": "\t"}} + * + * - [»] List item + * - [»] List item + * + * @example {"name": "not-ok.md", "label": "input"} + * + * - [x] List item + * - [X] List item + * - [ ] List item + * - [»] List item + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:4-2:5: Checked checkboxes should use `x` as a marker + * 4:4-4:5: Unchecked checkboxes should use ` ` as a marker + * + * @example {"setting": {"unchecked": "💩"}, "name": "not-ok.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect unchecked checkbox marker `💩`: use either `'\t'`, or `' '` + * + * @example {"setting": {"checked": "💩"}, "name": "not-ok.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect checked checkbox marker `💩`: use either `'x'`, or `'X'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var vfileLocation = require('vfile-location') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:checkbox-character-style', + checkboxCharacterStyle +) + +var start = position.start +var end = position.end + +var checked = {x: true, X: true} +var unchecked = {' ': true, '\t': true} +var types = {true: 'checked', false: 'unchecked'} + +function checkboxCharacterStyle(tree, file, option) { + var contents = String(file) + var location = vfileLocation(file) + var preferred = typeof option === 'object' ? option : {} + + if (preferred.unchecked && unchecked[preferred.unchecked] !== true) { + file.fail( + 'Incorrect unchecked checkbox marker `' + + preferred.unchecked + + "`: use either `'\\t'`, or `' '`" + ) + } + + if (preferred.checked && checked[preferred.checked] !== true) { + file.fail( + 'Incorrect checked checkbox marker `' + + preferred.checked + + "`: use either `'x'`, or `'X'`" + ) + } + + visit(tree, 'listItem', visitor) + + function visitor(node) { + var type + var initial + var final + var value + var style + var character + var reason + + // Exit early for items without checkbox. + if (typeof node.checked !== 'boolean' || generated(node)) { + return + } + + type = types[node.checked] + initial = start(node).offset + final = (node.children.length === 0 ? end(node) : start(node.children[0])) + .offset + + // For a checkbox to be parsed, it must be followed by a whitespace. + value = contents.slice(initial, final).replace(/\s+$/, '').slice(0, -1) + + // The checkbox character is behind a square bracket. + character = value.charAt(value.length - 1) + style = preferred[type] + + if (style) { + if (character !== style) { + reason = + type.charAt(0).toUpperCase() + + type.slice(1) + + ' checkboxes should use `' + + style + + '` as a marker' + + file.message(reason, { + start: location.toPosition(initial + value.length - 1), + end: location.toPosition(initial + value.length) + }) + } + } else { + preferred[type] = character + } + } +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/index.js b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/license b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-checkbox-character-style/node_modules/unist-util-is/package.json b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..2a82f866 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-checkbox-character-style/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-checkbox-character-style/unist-util-visit", + "/remark-lint-checkbox-character-style/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..10e745d5 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-checkbox-character-style/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-checkbox-character-style/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/license b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-checkbox-character-style/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..fb46bd57 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-checkbox-character-style/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-checkbox-character-style" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-checkbox-character-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/index.js b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/index.js new file mode 100644 index 00000000..b7b74dd0 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/index.js @@ -0,0 +1,76 @@ +'use strict' + +module.exports = factory + +function factory(file) { + var contents = indices(String(file)) + var toPoint = offsetToPointFactory(contents) + + return { + toPoint: toPoint, + toPosition: toPoint, + toOffset: pointToOffsetFactory(contents) + } +} + +// Factory to get the line and column-based `point` for `offset` in the bound +// indices. +function offsetToPointFactory(indices) { + return offsetToPoint + + // Get the line and column-based `point` for `offset` in the bound indices. + function offsetToPoint(offset) { + var index = -1 + var length = indices.length + + if (offset < 0) { + return {} + } + + while (++index < length) { + if (indices[index] > offset) { + return { + line: index + 1, + column: offset - (indices[index - 1] || 0) + 1, + offset: offset + } + } + } + + return {} + } +} + +// Factory to get the `offset` for a line and column-based `point` in the +// bound indices. +function pointToOffsetFactory(indices) { + return pointToOffset + + // Get the `offset` for a line and column-based `point` in the bound + // indices. + function pointToOffset(point) { + var line = point && point.line + var column = point && point.column + + if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { + return (indices[line - 2] || 0) + column - 1 || 0 + } + + return -1 + } +} + +// Get indices of line-breaks in `value`. +function indices(value) { + var result = [] + var index = value.indexOf('\n') + + while (index !== -1) { + result.push(index + 1) + index = value.indexOf('\n', index + 1) + } + + result.push(value.length + 1) + + return result +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/license b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-checkbox-character-style/node_modules/vfile-location/package.json b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/package.json new file mode 100644 index 00000000..b37c68e7 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/package.json @@ -0,0 +1,129 @@ +{ + "_from": "vfile-location@^3.0.0", + "_id": "vfile-location@3.1.0", + "_inBundle": false, + "_integrity": "sha512-FCZ4AN9xMcjFIG1oGmZKo61PjwJHRVA+0/tPUP2ul4uIwjGGndIxavEMRpWn5p4xwm/ZsdXp9YNygf1ZyE4x8g==", + "_location": "/remark-lint-checkbox-character-style/vfile-location", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "vfile-location@^3.0.0", + "name": "vfile-location", + "escapedName": "vfile-location", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-checkbox-character-style" + ], + "_resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.1.0.tgz", + "_shasum": "81cd8a04b0ac935185f4fce16f270503fc2f692f", + "_spec": "vfile-location@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-checkbox-character-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/vfile/vfile-location/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "vfile utility to convert between positional (line and column-based) and offset (range-based) locations", + "devDependencies": { + "@types/unist": "^2.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^3.0.0", + "vfile": "^4.0.0", + "xo": "^0.33.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/vfile/vfile-location#readme", + "keywords": [ + "vfile", + "vfile-util", + "util", + "utility", + "virtual", + "file", + "location", + "point", + "position", + "offset" + ], + "license": "MIT", + "name": "vfile-location", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vfile/vfile-location.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s vfileLocation > vfile-location.js", + "build-mangle": "browserify . -s vfileLocation -p tinyify > vfile-location.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-number-properties": "off" + }, + "ignores": [ + "vfile-location.js" + ] + } +} diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/readme.md b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/readme.md new file mode 100644 index 00000000..ea7cd42f --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/readme.md @@ -0,0 +1,114 @@ +# vfile-location + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Convert between positional (line and column-based) and offsets (range-based) +locations in a [virtual file][vfile]. + +## Install + +[npm][]: + +```sh +npm install vfile-location +``` + +## Use + +```js +var vfile = require('vfile') +var vfileLocation = require('vfile-location') + +var location = vfileLocation(vfile('foo\nbar\nbaz')) + +var offset = location.toOffset({line: 3, column: 3}) // => 10 +location.toPoint(offset) // => {line: 3, column: 3, offset: 10} +``` + +## API + +### `location = vfileLocation(doc)` + +Get transform functions for the given `doc` (`string`) or [`file`][vfile]. + +Returns an object with [`toOffset`][to-offset] and [`toPoint`][to-point]. + +### `location.toOffset(point)` + +Get the `offset` (`number`) for a line and column-based [`point`][point] in the +bound file. +Returns `-1` when given invalid or out of bounds input. + +### `location.toPoint(offset)` + +Get the line and column-based [`point`][point] for `offset` in the bound file. + +## Contribute + +See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to +get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/vfile/vfile-location.svg + +[build]: https://travis-ci.org/vfile/vfile-location + +[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-location.svg + +[coverage]: https://codecov.io/github/vfile/vfile-location + +[downloads-badge]: https://img.shields.io/npm/dm/vfile-location.svg + +[downloads]: https://www.npmjs.com/package/vfile-location + +[size-badge]: https://img.shields.io/bundlephobia/minzip/vfile-location.svg + +[size]: https://bundlephobia.com/result?p=vfile-location + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/vfile/vfile/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[contributing]: https://github.com/vfile/.github/blob/HEAD/contributing.md + +[support]: https://github.com/vfile/.github/blob/HEAD/support.md + +[health]: https://github.com/vfile/.github + +[coc]: https://github.com/vfile/.github/blob/HEAD/code-of-conduct.md + +[license]: license + +[author]: https://wooorm.com + +[vfile]: https://github.com/vfile/vfile + +[to-offset]: #locationtooffsetpoint + +[to-point]: #locationtopointoffset + +[point]: https://github.com/syntax-tree/unist#point diff --git a/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/types/index.d.ts b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/types/index.d.ts new file mode 100644 index 00000000..ef5c6d01 --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/node_modules/vfile-location/types/index.d.ts @@ -0,0 +1,34 @@ +// TypeScript Version: 3.0 + +import {Point} from 'unist' +import {VFile} from 'vfile' + +declare namespace vfileLocation { + type PositionalPoint = Pick + type FullPoint = Required + type Offset = NonNullable + /** @deprecated */ + type Position = PositionalPoint + + interface Location { + /** + * Get the offset for a line and column based position in the bound file. + * Returns `-1` when given invalid or out of bounds input. + */ + toOffset: (point: PositionalPoint) => Offset + + /** + * Get the line and column-based point for offset in the bound file. + */ + toPoint: (offset: Offset) => FullPoint + /** @deprecated */ + toPosition: (offset: Offset) => FullPoint + } +} + +/** + * Get transform functions for the given `document`. + */ +declare function vfileLocation(document: string | VFile): vfileLocation.Location + +export = vfileLocation diff --git a/node_modules/remark-lint-checkbox-character-style/package.json b/node_modules/remark-lint-checkbox-character-style/package.json new file mode 100644 index 00000000..2a2e8c8e --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/package.json @@ -0,0 +1,77 @@ +{ + "_from": "remark-lint-checkbox-character-style@^2.0.0", + "_id": "remark-lint-checkbox-character-style@2.0.1", + "_inBundle": false, + "_integrity": "sha512-ANs1HaNOEYmc+O9Xyew7HRA48VXPnk7VLM76fLEf6bifXZU+VAJe+a6cmS+ohTSVSTjkMDl9dnbqiWQRE1U4zg==", + "_location": "/remark-lint-checkbox-character-style", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-checkbox-character-style@^2.0.0", + "name": "remark-lint-checkbox-character-style", + "escapedName": "remark-lint-checkbox-character-style", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-2.0.1.tgz", + "_shasum": "2ff2df31cb0ec99744f5122086610578c2d13754", + "_spec": "remark-lint-checkbox-character-style@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0", + "vfile-location": "^3.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when list item checkboxes violate a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "checkbox", + "style", + "task", + "list" + ], + "license": "MIT", + "name": "remark-lint-checkbox-character-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-checkbox-character-style" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-checkbox-character-style/readme.md b/node_modules/remark-lint-checkbox-character-style/readme.md new file mode 100644 index 00000000..79d0d14d --- /dev/null +++ b/node_modules/remark-lint-checkbox-character-style/readme.md @@ -0,0 +1,248 @@ + + +# remark-lint-checkbox-character-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when list item checkboxes violate a given style. + +Options: `Object` or `'consistent'`, default: `'consistent'`. + +`'consistent'` detects the first used checked and unchecked checkbox +styles and warns when subsequent checkboxes use different styles. + +Styles can also be passed in like so: + +```js +{checked: 'x', unchecked: ' '} +``` + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats checked checkboxes using `x` (lowercase X) and unchecked checkboxes +as `·` (a single space). + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | + +## Example + +##### `ok.md` + +When configured with `{ checked: 'x' }`. + +###### In + +```markdown +- [x] List item +- [x] List item +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `{ checked: 'X' }`. + +###### In + +```markdown +- [X] List item +- [X] List item +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `{ unchecked: ' ' }`. + +###### In + +Note: `·` represents a space. + +```markdown +- [ ] List item +- [ ] List item +- [ ]·· +- [ ] +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `{ unchecked: '\t' }`. + +###### In + +Note: `»` represents a tab. + +```markdown +- [»] List item +- [»] List item +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `»` represents a tab. + +```markdown +- [x] List item +- [X] List item +- [ ] List item +- [»] List item +``` + +###### Out + +```text +2:4-2:5: Checked checkboxes should use `x` as a marker +4:4-4:5: Unchecked checkboxes should use ` ` as a marker +``` + +##### `not-ok.md` + +When configured with `{ unchecked: '💩' }`. + +###### Out + +```text +1:1: Incorrect unchecked checkbox marker `💩`: use either `'\t'`, or `' '` +``` + +##### `not-ok.md` + +When configured with `{ checked: '💩' }`. + +###### Out + +```text +1:1: Incorrect checked checkbox marker `💩`: use either `'x'`, or `'X'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-checkbox-character-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-checkbox-character-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-checkbox-character-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-checkbox-character-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-checkbox-character-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-checkbox-character-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-checkbox-character-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-checkbox-character-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-code-block-style/index.js b/node_modules/remark-lint-code-block-style/index.js new file mode 100644 index 00000000..ec29733f --- /dev/null +++ b/node_modules/remark-lint-code-block-style/index.js @@ -0,0 +1,149 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module code-block-style + * @fileoverview + * Warn when code blocks do not adhere to a given style. + * + * Options: `'consistent'`, `'fenced'`, or `'indented'`, default: `'consistent'`. + * + * `'consistent'` detects the first used code block style and warns when + * subsequent code blocks uses different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats code blocks using a fence if they have a language flag and + * indentation if not. + * Pass + * [`fences: true`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsfences) + * to always use fences for code blocks. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"setting": "indented", "name": "ok.md"} + * + * alpha(); + * + * Paragraph. + * + * bravo(); + * + * @example {"setting": "indented", "name": "not-ok.md", "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"setting": "indented", "name": "not-ok.md", "label": "output"} + * + * 1:1-3:4: Code blocks should be indented + * 7:1-9:4: Code blocks should be indented + * + * @example {"setting": "fenced", "name": "ok.md"} + * + * ``` + * alpha(); + * ``` + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"setting": "fenced", "name": "not-ok-fenced.md", "label": "input"} + * + * alpha(); + * + * Paragraph. + * + * bravo(); + * + * @example {"setting": "fenced", "name": "not-ok-fenced.md", "label": "output"} + * + * 1:1-1:13: Code blocks should be fenced + * 5:1-5:13: Code blocks should be fenced + * + * @example {"name": "not-ok-consistent.md", "label": "input"} + * + * alpha(); + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"name": "not-ok-consistent.md", "label": "output"} + * + * 5:1-7:4: Code blocks should be indented + * + * @example {"setting": "💩", "name": "not-ok-incorrect.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect code block style `💩`: use either `'consistent'`, `'fenced'`, or `'indented'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:code-block-style', codeBlockStyle) + +var start = position.start +var end = position.end + +var styles = {null: true, fenced: true, indented: true} + +function codeBlockStyle(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect code block style `' + + preferred + + "`: use either `'consistent'`, `'fenced'`, or `'indented'`" + ) + } + + visit(tree, 'code', visitor) + + function visitor(node) { + var initial + var final + var current + + if (generated(node)) { + return null + } + + initial = start(node).offset + final = end(node).offset + + current = + node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final)) + ? 'fenced' + : 'indented' + + if (preferred) { + if (preferred !== current) { + file.message('Code blocks should be ' + preferred, node) + } + } else { + preferred = current + } + } +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/index.js b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/license b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-code-block-style/node_modules/unist-util-is/package.json b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..9679d24b --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-code-block-style/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-code-block-style/unist-util-visit", + "/remark-lint-code-block-style/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-code-block-style/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..9007e6ef --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-code-block-style/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-code-block-style/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/license b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-code-block-style/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..f52055d6 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-code-block-style/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-code-block-style" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-code-block-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-code-block-style/package.json b/node_modules/remark-lint-code-block-style/package.json new file mode 100644 index 00000000..647509c5 --- /dev/null +++ b/node_modules/remark-lint-code-block-style/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-code-block-style@^2.0.0", + "_id": "remark-lint-code-block-style@2.0.1", + "_inBundle": false, + "_integrity": "sha512-eRhmnColmSxJhO61GHZkvO67SpHDshVxs2j3+Zoc5Y1a4zQT2133ZAij04XKaBFfsVLjhbY/+YOWxgvtjx2nmA==", + "_location": "/remark-lint-code-block-style", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-code-block-style@^2.0.0", + "name": "remark-lint-code-block-style", + "escapedName": "remark-lint-code-block-style", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-2.0.1.tgz", + "_shasum": "448b0f2660acfcdfff2138d125ff5b1c1279c0cb", + "_spec": "remark-lint-code-block-style@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when code blocks do not adhere to a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "code", + "block" + ], + "license": "MIT", + "name": "remark-lint-code-block-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-code-block-style" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-code-block-style/readme.md b/node_modules/remark-lint-code-block-style/readme.md new file mode 100644 index 00000000..19e7b20b --- /dev/null +++ b/node_modules/remark-lint-code-block-style/readme.md @@ -0,0 +1,256 @@ + + +# remark-lint-code-block-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when code blocks do not adhere to a given style. + +Options: `'consistent'`, `'fenced'`, or `'indented'`, default: `'consistent'`. + +`'consistent'` detects the first used code block style and warns when +subsequent code blocks uses different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats code blocks using a fence if they have a language flag and +indentation if not. +Pass +[`fences: true`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsfences) +to always use fences for code blocks. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'fenced'` | + +## Example + +##### `ok.md` + +When configured with `'indented'`. + +###### In + +```markdown + alpha(); + +Paragraph. + + bravo(); +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'indented'`. + +###### In + +````markdown +``` +alpha(); +``` + +Paragraph. + +``` +bravo(); +``` +```` + +###### Out + +```text +1:1-3:4: Code blocks should be indented +7:1-9:4: Code blocks should be indented +``` + +##### `ok.md` + +When configured with `'fenced'`. + +###### In + +````markdown +``` +alpha(); +``` + +Paragraph. + +``` +bravo(); +``` +```` + +###### Out + +No messages. + +##### `not-ok-fenced.md` + +When configured with `'fenced'`. + +###### In + +```markdown + alpha(); + +Paragraph. + + bravo(); +``` + +###### Out + +```text +1:1-1:13: Code blocks should be fenced +5:1-5:13: Code blocks should be fenced +``` + +##### `not-ok-consistent.md` + +###### In + +````markdown + alpha(); + +Paragraph. + +``` +bravo(); +``` +```` + +###### Out + +```text +5:1-7:4: Code blocks should be indented +``` + +##### `not-ok-incorrect.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect code block style `💩`: use either `'consistent'`, `'fenced'`, or `'indented'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-code-block-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-code-block-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-code-block-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-code-block-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-code-block-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-code-block-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-code-block-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-code-block-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-definition-case/index.js b/node_modules/remark-lint-definition-case/index.js new file mode 100644 index 00000000..13693125 --- /dev/null +++ b/node_modules/remark-lint-definition-case/index.js @@ -0,0 +1,52 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module definition-case + * @fileoverview + * Warn when definition labels are not lowercase. + * + * @example {"name": "ok.md"} + * + * [example]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [Example]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:47: Do not use uppercase characters in definition labels + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:definition-case', definitionCase) + +var label = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/ +var reason = 'Do not use uppercase characters in definition labels' + +function definitionCase(tree, file) { + var contents = String(file) + + visit(tree, ['definition', 'footnoteDefinition'], check) + + function check(node) { + var start = position.start(node).offset + var end = position.end(node).offset + var value + + if (!generated(node)) { + value = contents.slice(start, end).match(label)[1] + + if (value !== value.toLowerCase()) { + file.message(reason, node) + } + } + } +} diff --git a/node_modules/remark-lint-definition-case/package.json b/node_modules/remark-lint-definition-case/package.json new file mode 100644 index 00000000..f0586539 --- /dev/null +++ b/node_modules/remark-lint-definition-case/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-definition-case@^1.0.0", + "_id": "remark-lint-definition-case@1.0.5", + "_inBundle": false, + "_integrity": "sha512-iirq74fKhJZsFw7x4FJuLVRkXclntutG1YKajfLaE3Gm14YlJWBEoabNTk+ENR4QXoB9rTdEqn3Cc3ImO8qciQ==", + "_location": "/remark-lint-definition-case", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-definition-case@^1.0.0", + "name": "remark-lint-definition-case", + "escapedName": "remark-lint-definition-case", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-definition-case/-/remark-lint-definition-case-1.0.5.tgz", + "_shasum": "14746987b90bb91944bf2f7f9c2e0efdac48d9e9", + "_spec": "remark-lint-definition-case@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when definition labels are not lowercase", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "definition", + "case" + ], + "license": "MIT", + "name": "remark-lint-definition-case", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-definition-case" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-definition-case/readme.md b/node_modules/remark-lint-definition-case/readme.md new file mode 100644 index 00000000..494f1dd2 --- /dev/null +++ b/node_modules/remark-lint-definition-case/readme.md @@ -0,0 +1,148 @@ + + +# remark-lint-definition-case + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when definition labels are not lowercase. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +[example]: http://example.com "Example Domain" +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +[Example]: http://example.com "Example Domain" +``` + +###### Out + +```text +1:1-1:47: Do not use uppercase characters in definition labels +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-definition-case +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-definition-case", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-definition-case readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-definition-case')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-definition-case.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-definition-case + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-definition-case.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-definition-case + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-definition-spacing/index.js b/node_modules/remark-lint-definition-spacing/index.js new file mode 100644 index 00000000..3a6eb365 --- /dev/null +++ b/node_modules/remark-lint-definition-spacing/index.js @@ -0,0 +1,50 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module definition-spacing + * @fileoverview + * Warn when consecutive whitespace is used in a definition. + * + * @example {"name": "ok.md"} + * + * [example domain]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [example····domain]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:57: Do not use consecutive whitespace in definition labels + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:definition-spacing', definitionSpacing) + +var label = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/ +var reason = 'Do not use consecutive whitespace in definition labels' + +function definitionSpacing(tree, file) { + var contents = String(file) + + visit(tree, ['definition', 'footnoteDefinition'], check) + + function check(node) { + var start = position.start(node).offset + var end = position.end(node).offset + + if ( + !generated(node) && + /[ \t\n]{2,}/.test(contents.slice(start, end).match(label)[1]) + ) { + file.message(reason, node) + } + } +} diff --git a/node_modules/remark-lint-definition-spacing/package.json b/node_modules/remark-lint-definition-spacing/package.json new file mode 100644 index 00000000..3b4abb50 --- /dev/null +++ b/node_modules/remark-lint-definition-spacing/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-definition-spacing@^1.0.0", + "_id": "remark-lint-definition-spacing@1.0.5", + "_inBundle": false, + "_integrity": "sha512-ss8OQmK4c/1amEAJpDjkFiByLyXpsYFNzmk6rEZQkxZZd+DVHI0oF+CzSeMVHu48rF2qHOkKhVghqrCM0vleAA==", + "_location": "/remark-lint-definition-spacing", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-definition-spacing@^1.0.0", + "name": "remark-lint-definition-spacing", + "escapedName": "remark-lint-definition-spacing", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-1.0.5.tgz", + "_shasum": "d334b418fa66954c13450038056fd383963a6436", + "_spec": "remark-lint-definition-spacing@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when consecutive whitespace is used in a definition", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "definition", + "spacing" + ], + "license": "MIT", + "name": "remark-lint-definition-spacing", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-definition-spacing" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-definition-spacing/readme.md b/node_modules/remark-lint-definition-spacing/readme.md new file mode 100644 index 00000000..0ca9ef50 --- /dev/null +++ b/node_modules/remark-lint-definition-spacing/readme.md @@ -0,0 +1,150 @@ + + +# remark-lint-definition-spacing + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when consecutive whitespace is used in a definition. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +[example domain]: http://example.com "Example Domain" +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +[example····domain]: http://example.com "Example Domain" +``` + +###### Out + +```text +1:1-1:57: Do not use consecutive whitespace in definition labels +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-definition-spacing +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-definition-spacing", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-definition-spacing readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-definition-spacing')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-definition-spacing.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-definition-spacing + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-definition-spacing.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-definition-spacing + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-emphasis-marker/index.js b/node_modules/remark-lint-emphasis-marker/index.js new file mode 100644 index 00000000..ca876fe4 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/index.js @@ -0,0 +1,107 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module emphasis-marker + * @fileoverview + * Warn for violating emphasis markers. + * + * Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + * + * `'consistent'` detects the first used emphasis style and warns when + * subsequent emphasis use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats emphasis using `_` (underscore) by default. + * Pass + * [`emphasis: '*'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsemphasis) + * to use `*` (asterisk) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"setting": "*", "name": "ok.md"} + * + * *foo* + * + * @example {"setting": "*", "name": "not-ok.md", "label": "input"} + * + * _foo_ + * + * @example {"setting": "*", "name": "not-ok.md", "label": "output"} + * + * 1:1-1:6: Emphasis should use `*` as a marker + * + * @example {"setting": "_", "name": "ok.md"} + * + * _foo_ + * + * @example {"setting": "_", "name": "not-ok.md", "label": "input"} + * + * *foo* + * + * @example {"setting": "_", "name": "not-ok.md", "label": "output"} + * + * 1:1-1:6: Emphasis should use `_` as a marker + * + * @example {"name": "not-ok.md", "label": "input"} + * + * *foo* + * _bar_ + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:1-2:6: Emphasis should use `*` as a marker + * + * @example {"setting": "💩", "name": "not-ok.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect emphasis marker `💩`: use either `'consistent'`, `'*'`, or `'_'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:emphasis-marker', emphasisMarker) + +var markers = {null: true, '*': true, _: true} + +function emphasisMarker(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (markers[preferred] !== true) { + file.fail( + 'Incorrect emphasis marker `' + + preferred + + "`: use either `'consistent'`, `'*'`, or `'_'`" + ) + } + + visit(tree, 'emphasis', visitor) + + function visitor(node) { + var marker + + if (!generated(node)) { + marker = contents.charAt(position.start(node).offset) + + if (preferred) { + if (marker !== preferred) { + file.message( + 'Emphasis should use `' + preferred + '` as a marker', + node + ) + } + } else { + preferred = marker + } + } + } +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/index.js b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/license b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-emphasis-marker/node_modules/unist-util-is/package.json b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..0323a0d5 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-emphasis-marker/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-emphasis-marker/unist-util-visit", + "/remark-lint-emphasis-marker/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..b424ea49 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-emphasis-marker/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-emphasis-marker/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/license b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-emphasis-marker/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..7aea1710 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-emphasis-marker/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-emphasis-marker" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-emphasis-marker", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-emphasis-marker/package.json b/node_modules/remark-lint-emphasis-marker/package.json new file mode 100644 index 00000000..d65c74cb --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-emphasis-marker@^2.0.0", + "_id": "remark-lint-emphasis-marker@2.0.1", + "_inBundle": false, + "_integrity": "sha512-7mpbAUrSnHiWRyGkbXRL5kfSKY9Cs8cdob7Fw+Z02/pufXMF4yRWaegJ5NTUu1RE+SKlF44wtWWjvcIoyY6/aw==", + "_location": "/remark-lint-emphasis-marker", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-emphasis-marker@^2.0.0", + "name": "remark-lint-emphasis-marker", + "escapedName": "remark-lint-emphasis-marker", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-emphasis-marker/-/remark-lint-emphasis-marker-2.0.1.tgz", + "_shasum": "1d5ca2070d4798d16c23120726158157796dc317", + "_spec": "remark-lint-emphasis-marker@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when emphasis markers violate the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "emphasis", + "marker" + ], + "license": "MIT", + "name": "remark-lint-emphasis-marker", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-emphasis-marker" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-emphasis-marker/readme.md b/node_modules/remark-lint-emphasis-marker/readme.md new file mode 100644 index 00000000..068b066e --- /dev/null +++ b/node_modules/remark-lint-emphasis-marker/readme.md @@ -0,0 +1,224 @@ + + +# remark-lint-emphasis-marker + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for violating emphasis markers. + +Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + +`'consistent'` detects the first used emphasis style and warns when +subsequent emphasis use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats emphasis using `_` (underscore) by default. +Pass +[`emphasis: '*'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsemphasis) +to use `*` (asterisk) instead. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'*'` | + +## Example + +##### `ok.md` + +When configured with `'*'`. + +###### In + +```markdown +*foo* +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'*'`. + +###### In + +```markdown +_foo_ +``` + +###### Out + +```text +1:1-1:6: Emphasis should use `*` as a marker +``` + +##### `ok.md` + +When configured with `'_'`. + +###### In + +```markdown +_foo_ +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'_'`. + +###### In + +```markdown +*foo* +``` + +###### Out + +```text +1:1-1:6: Emphasis should use `_` as a marker +``` + +##### `not-ok.md` + +###### In + +```markdown +*foo* +_bar_ +``` + +###### Out + +```text +2:1-2:6: Emphasis should use `*` as a marker +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect emphasis marker `💩`: use either `'consistent'`, `'*'`, or `'_'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-emphasis-marker +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-emphasis-marker", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-emphasis-marker readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-emphasis-marker')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-emphasis-marker.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-emphasis-marker + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-emphasis-marker.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-emphasis-marker + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-fenced-code-flag/index.js b/node_modules/remark-lint-fenced-code-flag/index.js new file mode 100644 index 00000000..9e13f837 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-flag/index.js @@ -0,0 +1,117 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module fenced-code-flag + * @fileoverview + * Check fenced code block flags. + * + * Options: `Array.` or `Object`, optional. + * + * Providing an array is as passing `{flags: Array}`. + * + * The object can have an array of `'flags'` which are allowed: other flags + * will not be allowed. + * An `allowEmpty` field (`boolean`, default: `false`) can be set to allow + * code blocks without language flags. + * + * @example {"name": "ok.md"} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "not-ok.md", "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-3:4: Missing code language flag + * + * @example {"name": "ok.md", "setting": {"allowEmpty": true}} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * @example {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "output"} + * + * 1:1-3:4: Missing code language flag + * + * @example {"name": "ok.md", "setting": ["alpha"]} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "not-ok.md", "setting": ["charlie"], "label": "input"} + * + * ```alpha + * bravo(); + * ``` + * + * @example {"name": "not-ok.md", "setting": ["charlie"], "label": "output"} + * + * 1:1-3:4: Incorrect code language flag + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:fenced-code-flag', fencedCodeFlag) + +var start = position.start +var end = position.end + +var fence = /^ {0,3}([~`])\1{2,}/ +var reasonIncorrect = 'Incorrect code language flag' +var reasonMissing = 'Missing code language flag' + +function fencedCodeFlag(tree, file, option) { + var contents = String(file) + var allowEmpty = false + var allowed = [] + var flags = option + + if (typeof flags === 'object' && !('length' in flags)) { + allowEmpty = Boolean(flags.allowEmpty) + flags = flags.flags + } + + if (typeof flags === 'object' && 'length' in flags) { + allowed = String(flags).split(',') + } + + visit(tree, 'code', visitor) + + function visitor(node) { + var value + + if (!generated(node)) { + if (node.lang) { + if (allowed.length !== 0 && allowed.indexOf(node.lang) === -1) { + file.message(reasonIncorrect, node) + } + } else { + value = contents.slice(start(node).offset, end(node).offset) + + if (!allowEmpty && fence.test(value)) { + file.message(reasonMissing, node) + } + } + } + } +} diff --git a/node_modules/remark-lint-fenced-code-flag/package.json b/node_modules/remark-lint-fenced-code-flag/package.json new file mode 100644 index 00000000..38949f77 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-flag/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-fenced-code-flag@^1.0.0", + "_id": "remark-lint-fenced-code-flag@1.0.4", + "_inBundle": false, + "_integrity": "sha512-bkQvlEYco6ZzdzvGPrY7DBsqSq/2mZEmdhpn0KdMEZ9kcKJP4unQdVQys04SKnf9QISqQ446VnQj5Q4E3HMSkQ==", + "_location": "/remark-lint-fenced-code-flag", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-fenced-code-flag@^1.0.0", + "name": "remark-lint-fenced-code-flag", + "escapedName": "remark-lint-fenced-code-flag", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-1.0.4.tgz", + "_shasum": "9b0b2f1b0e3a919697d6b24230cd250353b1d5c8", + "_spec": "remark-lint-fenced-code-flag@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when fenced code blocks occur without language flag", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "fenced", + "code", + "flag", + "infostring" + ], + "license": "MIT", + "name": "remark-lint-fenced-code-flag", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-fenced-code-flag" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-fenced-code-flag/readme.md b/node_modules/remark-lint-fenced-code-flag/readme.md new file mode 100644 index 00000000..f9154b97 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-flag/readme.md @@ -0,0 +1,229 @@ + + +# remark-lint-fenced-code-flag + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Check fenced code block flags. + +Options: `Array.` or `Object`, optional. + +Providing an array is as passing `{flags: Array}`. + +The object can have an array of `'flags'` which are allowed: other flags +will not be allowed. +An `allowEmpty` field (`boolean`, default: `false`) can be set to allow +code blocks without language flags. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `{allowEmpty: false}` | + +## Example + +##### `ok.md` + +###### In + +````markdown +```alpha +bravo(); +``` +```` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +````markdown +``` +alpha(); +``` +```` + +###### Out + +```text +1:1-3:4: Missing code language flag +``` + +##### `ok.md` + +When configured with `{ allowEmpty: true }`. + +###### In + +````markdown +``` +alpha(); +``` +```` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `{ allowEmpty: false }`. + +###### In + +````markdown +``` +alpha(); +``` +```` + +###### Out + +```text +1:1-3:4: Missing code language flag +``` + +##### `ok.md` + +When configured with `[ 'alpha' ]`. + +###### In + +````markdown +```alpha +bravo(); +``` +```` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `[ 'charlie' ]`. + +###### In + +````markdown +```alpha +bravo(); +``` +```` + +###### Out + +```text +1:1-3:4: Incorrect code language flag +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-fenced-code-flag +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-fenced-code-flag", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-fenced-code-flag readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-fenced-code-flag')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-fenced-code-flag.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-fenced-code-flag + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-fenced-code-flag.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-fenced-code-flag + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-fenced-code-marker/index.js b/node_modules/remark-lint-fenced-code-marker/index.js new file mode 100644 index 00000000..9b1f7c2c --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/index.js @@ -0,0 +1,142 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module fenced-code-marker + * @fileoverview + * Warn for violating fenced code markers. + * + * Options: `` '`' ``, `'~'`, or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used fenced code marker style and warns + * when subsequent fenced code blocks use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats fences using ``'`'`` (grave accent) by default. + * Pass + * [`fence: '~'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsfence) + * to use `~` (tilde) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Indented code blocks are not affected by this rule: + * + * bravo(); + * + * @example {"name": "ok.md", "setting": "`"} + * + * ```alpha + * bravo(); + * ``` + * + * ``` + * charlie(); + * ``` + * + * @example {"name": "ok.md", "setting": "~"} + * + * ~~~alpha + * bravo(); + * ~~~ + * + * ~~~ + * charlie(); + * ~~~ + * + * @example {"name": "not-ok-consistent-tick.md", "label": "input"} + * + * ```alpha + * bravo(); + * ``` + * + * ~~~ + * charlie(); + * ~~~ + * + * @example {"name": "not-ok-consistent-tick.md", "label": "output"} + * + * 5:1-7:4: Fenced code should use `` ` `` as a marker + * + * @example {"name": "not-ok-consistent-tilde.md", "label": "input"} + * + * ~~~alpha + * bravo(); + * ~~~ + * + * ``` + * charlie(); + * ``` + * + * @example {"name": "not-ok-consistent-tilde.md", "label": "output"} + * + * 5:1-7:4: Fenced code should use `~` as a marker + * + * @example {"name": "not-ok-incorrect.md", "setting": "💩", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect fenced code marker `💩`: use either `'consistent'`, `` '`' ``, or `'~'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:fenced-code-marker', fencedCodeMarker) + +var markers = { + '`': true, + '~': true, + null: true +} + +function fencedCodeMarker(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (markers[preferred] !== true) { + file.fail( + 'Incorrect fenced code marker `' + + preferred + + "`: use either `'consistent'`, `` '`' ``, or `'~'`" + ) + } + + visit(tree, 'code', visitor) + + function visitor(node) { + var start + var marker + var label + + if (!generated(node)) { + start = position.start(node).offset + marker = contents + .slice(start, start + 4) + .replace(/^\s+/, '') + .charAt(0) + + // Ignore unfenced code blocks. + if (markers[marker] === true) { + if (preferred) { + if (marker !== preferred) { + label = preferred === '~' ? preferred : '` ` `' + file.message( + 'Fenced code should use `' + label + '` as a marker', + node + ) + } + } else { + preferred = marker + } + } + } + } +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/index.js b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/license b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-fenced-code-marker/node_modules/unist-util-is/package.json b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..8feeb573 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-fenced-code-marker/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-fenced-code-marker/unist-util-visit", + "/remark-lint-fenced-code-marker/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..8c76e712 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-fenced-code-marker/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-fenced-code-marker/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/license b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-fenced-code-marker/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..ad2e2716 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-fenced-code-marker/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-fenced-code-marker" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-fenced-code-marker", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-fenced-code-marker/package.json b/node_modules/remark-lint-fenced-code-marker/package.json new file mode 100644 index 00000000..8bdd1465 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-fenced-code-marker@^2.0.0", + "_id": "remark-lint-fenced-code-marker@2.0.1", + "_inBundle": false, + "_integrity": "sha512-lujpjm04enn3ma6lITlttadld6eQ1OWAEcT3qZzvFHp+zPraC0yr0eXlvtDN/0UH8mrln/QmGiZp3i8IdbucZg==", + "_location": "/remark-lint-fenced-code-marker", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-fenced-code-marker@^2.0.0", + "name": "remark-lint-fenced-code-marker", + "escapedName": "remark-lint-fenced-code-marker", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-2.0.1.tgz", + "_shasum": "7bbeb0fb45b0818a3c8a2d232cf0c723ade58ecf", + "_spec": "remark-lint-fenced-code-marker@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when fenced code markers violate the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "fenced", + "code", + "marker" + ], + "license": "MIT", + "name": "remark-lint-fenced-code-marker", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-marker" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-fenced-code-marker/readme.md b/node_modules/remark-lint-fenced-code-marker/readme.md new file mode 100644 index 00000000..77d4eab9 --- /dev/null +++ b/node_modules/remark-lint-fenced-code-marker/readme.md @@ -0,0 +1,243 @@ + + +# remark-lint-fenced-code-marker + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for violating fenced code markers. + +Options: ``'`'``, `'~'`, or `'consistent'`, default: `'consistent'`. + +`'consistent'` detects the first used fenced code marker style and warns +when subsequent fenced code blocks use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats fences using ``'`'`` (grave accent) by default. +Pass +[`fence: '~'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsfence) +to use `~` (tilde) instead. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | ``'`'`` | + +## Example + +##### `ok.md` + +###### In + +```markdown +Indented code blocks are not affected by this rule: + + bravo(); +``` + +###### Out + +No messages. + +##### `not-ok-consistent-tick.md` + +###### In + +````markdown +```alpha +bravo(); +``` + +~~~ +charlie(); +~~~ +```` + +###### Out + +```text +5:1-7:4: Fenced code should use `` ` `` as a marker +``` + +##### `not-ok-consistent-tilde.md` + +###### In + +````markdown +~~~alpha +bravo(); +~~~ + +``` +charlie(); +``` +```` + +###### Out + +```text +5:1-7:4: Fenced code should use `~` as a marker +``` + +##### `ok.md` + +When configured with ``'`'``. + +###### In + +````markdown +```alpha +bravo(); +``` + +``` +charlie(); +``` +```` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'~'`. + +###### In + +```markdown +~~~alpha +bravo(); +~~~ + +~~~ +charlie(); +~~~ +``` + +###### Out + +No messages. + +##### `not-ok-incorrect.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect fenced code marker `💩`: use either `'consistent'`, `` '`' ``, or `'~'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-fenced-code-marker +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-fenced-code-marker", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-fenced-code-marker readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-fenced-code-marker')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-fenced-code-marker.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-fenced-code-marker + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-fenced-code-marker.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-fenced-code-marker + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-file-extension/index.js b/node_modules/remark-lint-file-extension/index.js new file mode 100644 index 00000000..c0849fe2 --- /dev/null +++ b/node_modules/remark-lint-file-extension/index.js @@ -0,0 +1,38 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module file-extension + * @fileoverview + * Warn when the file extension differ from the preferred extension. + * + * Does not warn when given documents have no file extensions (such as + * `AUTHORS` or `LICENSE`). + * + * Options: `string`, default: `'md'` — Expected file extension. + * + * @example {"name": "readme.md"} + * + * @example {"name": "readme"} + * + * @example {"name": "readme.mkd", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect extension: use `md` + * + * @example {"name": "readme.mkd", "setting": "mkd"} + */ + +'use strict' + +var rule = require('unified-lint-rule') + +module.exports = rule('remark-lint:file-extension', fileExtension) + +function fileExtension(tree, file, option) { + var ext = file.extname + var preferred = typeof option === 'string' ? option : 'md' + + if (ext && ext.slice(1) !== preferred) { + file.message('Incorrect extension: use `' + preferred + '`') + } +} diff --git a/node_modules/remark-lint-file-extension/package.json b/node_modules/remark-lint-file-extension/package.json new file mode 100644 index 00000000..01f12f76 --- /dev/null +++ b/node_modules/remark-lint-file-extension/package.json @@ -0,0 +1,70 @@ +{ + "_from": "remark-lint-file-extension@^1.0.0", + "_id": "remark-lint-file-extension@1.0.5", + "_inBundle": false, + "_integrity": "sha512-oVQdf5vEomwHkfQ7R/mgmsWW2H/t9kSvnrxtVoNOHr+qnOEafKKDn+AFhioN2kqtjCZBAjSSrePs6xGKmXKDTw==", + "_location": "/remark-lint-file-extension", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-file-extension@^1.0.0", + "name": "remark-lint-file-extension", + "escapedName": "remark-lint-file-extension", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-1.0.5.tgz", + "_shasum": "7e2feec02919aa3db5c71fda19d726a9e24a4c6c", + "_spec": "remark-lint-file-extension@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when the file’s extension violates the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "file", + "extension", + "extname" + ], + "license": "MIT", + "name": "remark-lint-file-extension", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-file-extension" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-file-extension/readme.md b/node_modules/remark-lint-file-extension/readme.md new file mode 100644 index 00000000..0d9c6b0c --- /dev/null +++ b/node_modules/remark-lint-file-extension/readme.md @@ -0,0 +1,155 @@ + + +# remark-lint-file-extension + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the file extension differ from the preferred extension. + +Does not warn when given documents have no file extensions (such as +`AUTHORS` or `LICENSE`). + +Options: `string`, default: `'md'` — Expected file extension. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'md'` | + +## Example + +##### `readme.md` + +###### Out + +No messages. + +##### `readme` + +###### Out + +No messages. + +##### `readme.mkd` + +###### Out + +```text +1:1: Incorrect extension: use `md` +``` + +##### `readme.mkd` + +When configured with `'mkd'`. + +###### Out + +No messages. + +## Install + +[npm][]: + +```sh +npm install remark-lint-file-extension +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-file-extension", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-file-extension readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-file-extension')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-file-extension.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-file-extension + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-file-extension.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-file-extension + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-final-definition/index.js b/node_modules/remark-lint-final-definition/index.js new file mode 100644 index 00000000..4ea99505 --- /dev/null +++ b/node_modules/remark-lint-final-definition/index.js @@ -0,0 +1,66 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module final-definition + * @fileoverview + * Warn when definitions are placed somewhere other than at the end of + * the file. + * + * @example {"name": "ok.md"} + * + * Paragraph. + * + * [example]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Paragraph. + * + * [example]: http://example.com "Example Domain" + * + * Another paragraph. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:47: Move definitions to the end of the file (after the node at line `5`) + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:final-definition', finalDefinition) + +var start = position.start + +function finalDefinition(tree, file) { + var last = null + + visit(tree, visitor, true) + + function visitor(node) { + var line = start(node).line + + // Ignore generated nodes. + if (node.type === 'root' || generated(node)) { + return + } + + if (node.type === 'definition') { + if (last !== null && last > line) { + file.message( + 'Move definitions to the end of the file (after the node at line `' + + last + + '`)', + node + ) + } + } else if (last === null) { + last = line + } + } +} diff --git a/node_modules/remark-lint-final-definition/package.json b/node_modules/remark-lint-final-definition/package.json new file mode 100644 index 00000000..224470f7 --- /dev/null +++ b/node_modules/remark-lint-final-definition/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-final-definition@^1.0.0", + "_id": "remark-lint-final-definition@1.0.4", + "_inBundle": false, + "_integrity": "sha512-y9aDZPhqWcI7AtrJtL69HE6MoWMqDqLQUyWMadzAYUYb9/m4ciLdygJ4cWVpEN3n4mkBepHIsWzASaKHHBDJOQ==", + "_location": "/remark-lint-final-definition", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-final-definition@^1.0.0", + "name": "remark-lint-final-definition", + "escapedName": "remark-lint-final-definition", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-final-definition/-/remark-lint-final-definition-1.0.4.tgz", + "_shasum": "4ebf6f45a54b457d426e3247ef6727e3ce7aff60", + "_spec": "remark-lint-final-definition@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when definitions are not placed at the end of the file", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "definition", + "position", + "final" + ], + "license": "MIT", + "name": "remark-lint-final-definition", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-final-definition" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-final-definition/readme.md b/node_modules/remark-lint-final-definition/readme.md new file mode 100644 index 00000000..259483cc --- /dev/null +++ b/node_modules/remark-lint-final-definition/readme.md @@ -0,0 +1,155 @@ + + +# remark-lint-final-definition + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when definitions are placed somewhere other than at the end of +the file. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +Paragraph. + +[example]: http://example.com "Example Domain" +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +Paragraph. + +[example]: http://example.com "Example Domain" + +Another paragraph. +``` + +###### Out + +```text +3:1-3:47: Move definitions to the end of the file (after the node at line `5`) +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-final-definition +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-final-definition", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-final-definition readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-final-definition')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-final-definition.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-final-definition + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-final-definition.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-final-definition + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-final-newline/index.js b/node_modules/remark-lint-final-newline/index.js new file mode 100644 index 00000000..9b52999f --- /dev/null +++ b/node_modules/remark-lint-final-newline/index.js @@ -0,0 +1,66 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module final-newline + * @fileoverview + * Warn when a line feed at the end of a file is missing. + * Empty files are allowed. + * + * See [StackExchange](https://unix.stackexchange.com/questions/18743) for why. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * always adds a final line feed to files. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * ## Example + * + * ##### `ok.md` + * + * ###### In + * + * Note: `␊` represents LF. + * + * ```markdown + * Alpha␊ + * ``` + * + * ###### Out + * + * No messages. + * + * ##### `not-ok.md` + * + * ###### In + * + * Note: The below file does not have a final newline. + * + * ```markdown + * Bravo + * ``` + * + * ###### Out + * + * ```text + * 1:1: Missing newline character at end of file + * ``` + */ + +'use strict' + +var rule = require('unified-lint-rule') + +module.exports = rule('remark-lint:final-newline', finalNewline) + +function finalNewline(tree, file) { + var contents = String(file) + var last = contents.length - 1 + + if (last > -1 && contents.charAt(last) !== '\n') { + file.message('Missing newline character at end of file') + } +} diff --git a/node_modules/remark-lint-final-newline/package.json b/node_modules/remark-lint-final-newline/package.json new file mode 100644 index 00000000..44440497 --- /dev/null +++ b/node_modules/remark-lint-final-newline/package.json @@ -0,0 +1,70 @@ +{ + "_from": "remark-lint-final-newline@^1.0.0", + "_id": "remark-lint-final-newline@1.0.5", + "_inBundle": false, + "_integrity": "sha512-rfLlW8+Fz2dqnaEgU4JwLA55CQF1T4mfSs/GwkkeUCGPenvEYwSkCN2KO2Gr1dy8qPoOdTFE1rSufLjmeTW5HA==", + "_location": "/remark-lint-final-newline", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-final-newline@^1.0.0", + "name": "remark-lint-final-newline", + "escapedName": "remark-lint-final-newline", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-1.0.5.tgz", + "_shasum": "666f609a91f97c44f5ab7facf1fb3c5b3ffe398f", + "_spec": "remark-lint-final-newline@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-recommended", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when a newline at the end of a file is missing", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "final", + "newline", + "unix" + ], + "license": "MIT", + "name": "remark-lint-final-newline", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-final-newline" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-final-newline/readme.md b/node_modules/remark-lint-final-newline/readme.md new file mode 100644 index 00000000..9c120896 --- /dev/null +++ b/node_modules/remark-lint-final-newline/readme.md @@ -0,0 +1,163 @@ + + +# remark-lint-final-newline + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when a line feed at the end of a file is missing. +Empty files are allowed. + +See [StackExchange](https://unix.stackexchange.com/questions/18743) for why. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +always adds a final line feed to files. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Example + +##### `ok.md` + +###### In + +Note: `␊` represents LF. + +```markdown +Alpha␊ +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: The below file does not have a final newline. + +```markdown +Bravo +``` + +###### Out + +```text +1:1: Missing newline character at end of file +``` + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended) | | + +## Install + +[npm][]: + +```sh +npm install remark-lint-final-newline +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-final-newline", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-final-newline readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-final-newline')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-final-newline.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-final-newline + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-final-newline.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-final-newline + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-hard-break-spaces/index.js b/node_modules/remark-lint-hard-break-spaces/index.js new file mode 100644 index 00000000..95f08d1d --- /dev/null +++ b/node_modules/remark-lint-hard-break-spaces/index.js @@ -0,0 +1,54 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module hard-break-spaces + * @fileoverview + * Warn when too many spaces are used to create a hard break. + * + * @example {"name": "ok.md"} + * + * Lorem ipsum·· + * dolor sit amet + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Lorem ipsum··· + * dolor sit amet. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:12-2:1: Use two spaces for hard line breaks + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:hard-break-spaces', hardBreakSpaces) + +var reason = 'Use two spaces for hard line breaks' + +function hardBreakSpaces(tree, file) { + var contents = String(file) + + visit(tree, 'break', visitor) + + function visitor(node) { + var value + + if (!generated(node)) { + value = contents + .slice(position.start(node).offset, position.end(node).offset) + .split('\n', 1)[0] + .replace(/\r$/, '') + + if (value.length > 2) { + file.message(reason, node) + } + } + } +} diff --git a/node_modules/remark-lint-hard-break-spaces/package.json b/node_modules/remark-lint-hard-break-spaces/package.json new file mode 100644 index 00000000..d7726582 --- /dev/null +++ b/node_modules/remark-lint-hard-break-spaces/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-hard-break-spaces@^1.0.0", + "_id": "remark-lint-hard-break-spaces@1.0.5", + "_inBundle": false, + "_integrity": "sha512-Rss7ujNtxipO/hasWYc0QdiO8D5VyliSwj3zAZ8GeDn0ix2KH+pY4/AJC7i9IGcVVbUGvvXLpJB3Pp1VeY7oKw==", + "_location": "/remark-lint-hard-break-spaces", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-hard-break-spaces@^1.0.0", + "name": "remark-lint-hard-break-spaces", + "escapedName": "remark-lint-hard-break-spaces", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-1.0.5.tgz", + "_shasum": "875c0b25d69eaadf71e6c5f2a5ebc8cd705e26ec", + "_spec": "remark-lint-hard-break-spaces@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when too many spaces are used to create a hard break", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "hard", + "break", + "spaces", + "size" + ], + "license": "MIT", + "name": "remark-lint-hard-break-spaces", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-hard-break-spaces" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-hard-break-spaces/readme.md b/node_modules/remark-lint-hard-break-spaces/readme.md new file mode 100644 index 00000000..2e129f2f --- /dev/null +++ b/node_modules/remark-lint-hard-break-spaces/readme.md @@ -0,0 +1,155 @@ + + +# remark-lint-hard-break-spaces + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when too many spaces are used to create a hard break. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +Lorem ipsum·· +dolor sit amet +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +Lorem ipsum··· +dolor sit amet. +``` + +###### Out + +```text +1:12-2:1: Use two spaces for hard line breaks +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-hard-break-spaces +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-hard-break-spaces", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-hard-break-spaces readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-hard-break-spaces')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-hard-break-spaces.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-hard-break-spaces + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-hard-break-spaces.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-hard-break-spaces + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-heading-increment/index.js b/node_modules/remark-lint-heading-increment/index.js new file mode 100644 index 00000000..3872bc68 --- /dev/null +++ b/node_modules/remark-lint-heading-increment/index.js @@ -0,0 +1,54 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module heading-increment + * @fileoverview + * Warn when headings increment with more than 1 level at a time. + * + * @example {"name": "ok.md"} + * + * # Alpha + * + * ## Bravo + * + * @example {"name": "not-ok.md", "label": "input"} + * + * # Charlie + * + * ### Delta + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:10: Heading levels should increment by one level at a time + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:heading-increment', headingIncrement) + +var reason = 'Heading levels should increment by one level at a time' + +function headingIncrement(tree, file) { + var previous = null + + visit(tree, 'heading', visitor) + + function visitor(node) { + var depth + + if (!generated(node)) { + depth = node.depth + + if (previous && depth > previous + 1) { + file.message(reason, node) + } + + previous = depth + } + } +} diff --git a/node_modules/remark-lint-heading-increment/package.json b/node_modules/remark-lint-heading-increment/package.json new file mode 100644 index 00000000..4c4bf290 --- /dev/null +++ b/node_modules/remark-lint-heading-increment/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-heading-increment@^1.0.0", + "_id": "remark-lint-heading-increment@1.0.4", + "_inBundle": false, + "_integrity": "sha512-3PJj32G7W1OUyRVSZiZbSOxyFAsw/mNssIosS9G8+6Lq2yeTSMDoCJy0+LC+s00nORFcbzeMedMK5U/eLbDe4w==", + "_location": "/remark-lint-heading-increment", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-heading-increment@^1.0.0", + "name": "remark-lint-heading-increment", + "escapedName": "remark-lint-heading-increment", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-heading-increment/-/remark-lint-heading-increment-1.0.4.tgz", + "_shasum": "a2bfb6449dda639ed65d361305e5f19a0243ee01", + "_spec": "remark-lint-heading-increment@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when headings increment with more than 1 level at a time", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "heading", + "increment", + "increase" + ], + "license": "MIT", + "name": "remark-lint-heading-increment", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-heading-increment" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-heading-increment/readme.md b/node_modules/remark-lint-heading-increment/readme.md new file mode 100644 index 00000000..ccb18df5 --- /dev/null +++ b/node_modules/remark-lint-heading-increment/readme.md @@ -0,0 +1,152 @@ + + +# remark-lint-heading-increment + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when headings increment with more than 1 level at a time. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +# Alpha + +## Bravo +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +# Charlie + +### Delta +``` + +###### Out + +```text +3:1-3:10: Heading levels should increment by one level at a time +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-heading-increment +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-heading-increment", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-heading-increment readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-heading-increment')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-heading-increment.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-heading-increment + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-heading-increment.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-heading-increment + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-heading-style/index.js b/node_modules/remark-lint-heading-style/index.js new file mode 100644 index 00000000..f306401b --- /dev/null +++ b/node_modules/remark-lint-heading-style/index.js @@ -0,0 +1,96 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module heading-style + * @fileoverview + * Warn when a heading does not conform to a given style. + * + * Options: `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'`, + * default: `'consistent'`. + * + * `'consistent'` detects the first used heading style and warns when + * subsequent headings use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats headings as ATX by default. + * This can be configured with the + * [`setext`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionssetext) + * and + * [`closeAtx`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionscloseatx) + * options. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "atx"} + * + * # Alpha + * + * ## Bravo + * + * ### Charlie + * + * @example {"name": "ok.md", "setting": "atx-closed"} + * + * # Delta ## + * + * ## Echo ## + * + * ### Foxtrot ### + * + * @example {"name": "ok.md", "setting": "setext"} + * + * Golf + * ==== + * + * Hotel + * ----- + * + * ### India + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Juliett + * ======= + * + * ## Kilo + * + * ### Lima ### + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 4:1-4:8: Headings should use setext + * 6:1-6:13: Headings should use setext + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var style = require('mdast-util-heading-style') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:heading-style', headingStyle) + +var types = ['atx', 'atx-closed', 'setext'] + +function headingStyle(tree, file, option) { + var preferred = types.indexOf(option) === -1 ? null : option + + visit(tree, 'heading', visitor) + + function visitor(node) { + if (!generated(node)) { + if (preferred) { + if (style(node, preferred) !== preferred) { + file.message('Headings should use ' + preferred, node) + } + } else { + preferred = style(node, preferred) + } + } + } +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-is/index.js b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-is/license b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-heading-style/node_modules/unist-util-is/package.json b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..c0740196 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-heading-style/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-heading-style/unist-util-visit", + "/remark-lint-heading-style/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-heading-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-heading-style/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..35588a08 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-heading-style/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-heading-style/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-heading-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/license b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-heading-style/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..a24dd4a1 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-heading-style/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-heading-style" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-heading-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-heading-style/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-heading-style/package.json b/node_modules/remark-lint-heading-style/package.json new file mode 100644 index 00000000..48b6c094 --- /dev/null +++ b/node_modules/remark-lint-heading-style/package.json @@ -0,0 +1,76 @@ +{ + "_from": "remark-lint-heading-style@^2.0.0", + "_id": "remark-lint-heading-style@2.0.1", + "_inBundle": false, + "_integrity": "sha512-IrFLNs0M5Vbn9qg51AYhGUfzgLAcDOjh2hFGMz3mx664dV6zLcNZOPSdJBBJq3JQR4gKpoXcNwN1+FFaIATj+A==", + "_location": "/remark-lint-heading-style", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-heading-style@^2.0.0", + "name": "remark-lint-heading-style", + "escapedName": "remark-lint-heading-style", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-2.0.1.tgz", + "_shasum": "8216fca67d97bbbeec8a19b6c71bfefc16549f72", + "_spec": "remark-lint-heading-style@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-heading-style": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when heading style violates the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "heading", + "style", + "atx", + "setext" + ], + "license": "MIT", + "name": "remark-lint-heading-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-heading-style" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-heading-style/readme.md b/node_modules/remark-lint-heading-style/readme.md new file mode 100644 index 00000000..0f20928a --- /dev/null +++ b/node_modules/remark-lint-heading-style/readme.md @@ -0,0 +1,218 @@ + + +# remark-lint-heading-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when a heading does not conform to a given style. + +Options: `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'`, +default: `'consistent'`. + +`'consistent'` detects the first used heading style and warns when +subsequent headings use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats headings as ATX by default. +This can be configured with the +[`setext`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionssetext) +and +[`closeAtx`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionscloseatx) +options. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'atx'` | + +## Example + +##### `ok.md` + +When configured with `'atx'`. + +###### In + +```markdown +# Alpha + +## Bravo + +### Charlie +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'atx-closed'`. + +###### In + +```markdown +# Delta ## + +## Echo ## + +### Foxtrot ### +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'setext'`. + +###### In + +```markdown +Golf +==== + +Hotel +----- + +### India +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +Juliett +======= + +## Kilo + +### Lima ### +``` + +###### Out + +```text +4:1-4:8: Headings should use setext +6:1-6:13: Headings should use setext +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-heading-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-heading-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-heading-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-heading-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-heading-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-heading-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-heading-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-heading-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-link-title-style/index.js b/node_modules/remark-lint-link-title-style/index.js new file mode 100644 index 00000000..03b031e9 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/index.js @@ -0,0 +1,195 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module link-title-style + * @fileoverview + * Warn when link and definition titles occur with incorrect quotes. + * + * Options: `'consistent'`, `'"'`, `'\''`, or `'()'`, default: `'consistent'`. + * + * `'consistent'` detects the first used quote style and warns when subsequent + * titles use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * uses `'` (single quote) for titles if they contain a double quote, and `"` + * (double quotes) otherwise. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "\""} + * + * [Example](http://example.com#without-title) + * [Example](http://example.com "Example Domain") + * ![Example](http://example.com "Example Domain") + * + * [Example]: http://example.com "Example Domain" + * + * You can use parens in URLs if they’re not a title (see GH-166): + * + * [Example](#Heading-(optional)) + * + * @example {"name": "not-ok.md", "label": "input", "setting": "\""} + * + * [Example]: http://example.com 'Example Domain' + * + * @example {"name": "not-ok.md", "label": "output", "setting": "\""} + * + * 1:31-1:47: Titles should use `"` as a quote + * + * @example {"name": "ok.md", "setting": "'"} + * + * [Example](http://example.com#without-title) + * [Example](http://example.com 'Example Domain') + * ![Example](http://example.com 'Example Domain') + * + * [Example]: http://example.com 'Example Domain' + * + * @example {"name": "not-ok.md", "label": "input", "setting": "'"} + * + * [Example]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "output", "setting": "'"} + * + * 1:31-1:47: Titles should use `'` as a quote + * + * @example {"name": "ok.md", "setting": "()"} + * + * [Example](http://example.com#without-title) + * [Example](http://example.com (Example Domain)) + * ![Example](http://example.com (Example Domain)) + * + * [Example]: http://example.com (Example Domain) + * + * @example {"name": "not-ok.md", "label": "input", "setting": "()"} + * + * [Example](http://example.com 'Example Domain') + * + * @example {"name": "not-ok.md", "label": "output", "setting": "()"} + * + * 1:30-1:46: Titles should use `()` as a quote + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [Example](http://example.com "Example Domain") + * [Example](http://example.com 'Example Domain') + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:30-2:46: Titles should use `"` as a quote + * + * @example {"name": "not-ok.md", "setting": "💩", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect link title style marker `💩`: use either `'consistent'`, `'"'`, `'\''`, or `'()'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var vfileLocation = require('vfile-location') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:link-title-style', linkTitleStyle) + +var own = {}.hasOwnProperty + +var start = position.start +var end = position.end + +var markers = { + '"': '"', + "'": "'", + ')': '(' +} + +function linkTitleStyle(tree, file, option) { + var contents = String(file) + var location = vfileLocation(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (preferred === '()' || preferred === '(') { + preferred = ')' + } + + if (preferred && !own.call(markers, preferred)) { + file.fail( + 'Incorrect link title style marker `' + + preferred + + "`: use either `'consistent'`, `'\"'`, `'\\''`, or `'()'`" + ) + } + + visit(tree, ['link', 'image', 'definition'], check) + + function check(node) { + var tail + var begin + var last + var first + var final + var initial + var reason + + if (generated(node)) { + return + } + + last = end(node).offset - 1 + tail = node.children ? node.children[node.children.length - 1] : null + begin = tail ? end(tail) : start(node) + + if (node.type !== 'definition') { + last-- + } + + // Skip back to before whitespace. + while (last) { + final = contents.charAt(last) + + /* istanbul ignore if - remark before 8.0.0 */ + if (/\s/.test(final)) { + last-- + } else { + break + } + } + + // Exit if the final marker is not a known marker. + if (!(final in markers)) { + return + } + + initial = markers[final] + + // Find the starting delimiter + first = contents.lastIndexOf(initial, last - 1) + + // Exit if there’s no starting delimiter, the starting delimiter is before + // the start of the node, or if it’s not preceded by whitespace. + if (first <= begin || !/\s/.test(contents.charAt(first - 1))) { + return + } + + if (preferred) { + if (preferred !== final) { + reason = + 'Titles should use `' + + (preferred === ')' ? '()' : preferred) + + '` as a quote' + + file.message(reason, { + start: location.toPosition(first), + end: location.toPosition(last + 1) + }) + } + } else { + preferred = final + } + } +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/index.js b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/license b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-link-title-style/node_modules/unist-util-is/package.json b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..1f621d18 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-link-title-style/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-link-title-style/unist-util-visit", + "/remark-lint-link-title-style/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-link-title-style/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..52a35e45 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-link-title-style/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-link-title-style/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/license b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-link-title-style/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..3d08c163 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-link-title-style/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-link-title-style" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-link-title-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-link-title-style/node_modules/vfile-location/index.js b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/index.js new file mode 100644 index 00000000..b7b74dd0 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/index.js @@ -0,0 +1,76 @@ +'use strict' + +module.exports = factory + +function factory(file) { + var contents = indices(String(file)) + var toPoint = offsetToPointFactory(contents) + + return { + toPoint: toPoint, + toPosition: toPoint, + toOffset: pointToOffsetFactory(contents) + } +} + +// Factory to get the line and column-based `point` for `offset` in the bound +// indices. +function offsetToPointFactory(indices) { + return offsetToPoint + + // Get the line and column-based `point` for `offset` in the bound indices. + function offsetToPoint(offset) { + var index = -1 + var length = indices.length + + if (offset < 0) { + return {} + } + + while (++index < length) { + if (indices[index] > offset) { + return { + line: index + 1, + column: offset - (indices[index - 1] || 0) + 1, + offset: offset + } + } + } + + return {} + } +} + +// Factory to get the `offset` for a line and column-based `point` in the +// bound indices. +function pointToOffsetFactory(indices) { + return pointToOffset + + // Get the `offset` for a line and column-based `point` in the bound + // indices. + function pointToOffset(point) { + var line = point && point.line + var column = point && point.column + + if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { + return (indices[line - 2] || 0) + column - 1 || 0 + } + + return -1 + } +} + +// Get indices of line-breaks in `value`. +function indices(value) { + var result = [] + var index = value.indexOf('\n') + + while (index !== -1) { + result.push(index + 1) + index = value.indexOf('\n', index + 1) + } + + result.push(value.length + 1) + + return result +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/vfile-location/license b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-link-title-style/node_modules/vfile-location/package.json b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/package.json new file mode 100644 index 00000000..6007d051 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/package.json @@ -0,0 +1,129 @@ +{ + "_from": "vfile-location@^3.0.0", + "_id": "vfile-location@3.1.0", + "_inBundle": false, + "_integrity": "sha512-FCZ4AN9xMcjFIG1oGmZKo61PjwJHRVA+0/tPUP2ul4uIwjGGndIxavEMRpWn5p4xwm/ZsdXp9YNygf1ZyE4x8g==", + "_location": "/remark-lint-link-title-style/vfile-location", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "vfile-location@^3.0.0", + "name": "vfile-location", + "escapedName": "vfile-location", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-link-title-style" + ], + "_resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.1.0.tgz", + "_shasum": "81cd8a04b0ac935185f4fce16f270503fc2f692f", + "_spec": "vfile-location@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-link-title-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/vfile/vfile-location/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "vfile utility to convert between positional (line and column-based) and offset (range-based) locations", + "devDependencies": { + "@types/unist": "^2.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^3.0.0", + "vfile": "^4.0.0", + "xo": "^0.33.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/vfile/vfile-location#readme", + "keywords": [ + "vfile", + "vfile-util", + "util", + "utility", + "virtual", + "file", + "location", + "point", + "position", + "offset" + ], + "license": "MIT", + "name": "vfile-location", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vfile/vfile-location.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s vfileLocation > vfile-location.js", + "build-mangle": "browserify . -s vfileLocation -p tinyify > vfile-location.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-number-properties": "off" + }, + "ignores": [ + "vfile-location.js" + ] + } +} diff --git a/node_modules/remark-lint-link-title-style/node_modules/vfile-location/readme.md b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/readme.md new file mode 100644 index 00000000..ea7cd42f --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/readme.md @@ -0,0 +1,114 @@ +# vfile-location + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Convert between positional (line and column-based) and offsets (range-based) +locations in a [virtual file][vfile]. + +## Install + +[npm][]: + +```sh +npm install vfile-location +``` + +## Use + +```js +var vfile = require('vfile') +var vfileLocation = require('vfile-location') + +var location = vfileLocation(vfile('foo\nbar\nbaz')) + +var offset = location.toOffset({line: 3, column: 3}) // => 10 +location.toPoint(offset) // => {line: 3, column: 3, offset: 10} +``` + +## API + +### `location = vfileLocation(doc)` + +Get transform functions for the given `doc` (`string`) or [`file`][vfile]. + +Returns an object with [`toOffset`][to-offset] and [`toPoint`][to-point]. + +### `location.toOffset(point)` + +Get the `offset` (`number`) for a line and column-based [`point`][point] in the +bound file. +Returns `-1` when given invalid or out of bounds input. + +### `location.toPoint(offset)` + +Get the line and column-based [`point`][point] for `offset` in the bound file. + +## Contribute + +See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to +get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/vfile/vfile-location.svg + +[build]: https://travis-ci.org/vfile/vfile-location + +[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-location.svg + +[coverage]: https://codecov.io/github/vfile/vfile-location + +[downloads-badge]: https://img.shields.io/npm/dm/vfile-location.svg + +[downloads]: https://www.npmjs.com/package/vfile-location + +[size-badge]: https://img.shields.io/bundlephobia/minzip/vfile-location.svg + +[size]: https://bundlephobia.com/result?p=vfile-location + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/vfile/vfile/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[contributing]: https://github.com/vfile/.github/blob/HEAD/contributing.md + +[support]: https://github.com/vfile/.github/blob/HEAD/support.md + +[health]: https://github.com/vfile/.github + +[coc]: https://github.com/vfile/.github/blob/HEAD/code-of-conduct.md + +[license]: license + +[author]: https://wooorm.com + +[vfile]: https://github.com/vfile/vfile + +[to-offset]: #locationtooffsetpoint + +[to-point]: #locationtopointoffset + +[point]: https://github.com/syntax-tree/unist#point diff --git a/node_modules/remark-lint-link-title-style/node_modules/vfile-location/types/index.d.ts b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/types/index.d.ts new file mode 100644 index 00000000..ef5c6d01 --- /dev/null +++ b/node_modules/remark-lint-link-title-style/node_modules/vfile-location/types/index.d.ts @@ -0,0 +1,34 @@ +// TypeScript Version: 3.0 + +import {Point} from 'unist' +import {VFile} from 'vfile' + +declare namespace vfileLocation { + type PositionalPoint = Pick + type FullPoint = Required + type Offset = NonNullable + /** @deprecated */ + type Position = PositionalPoint + + interface Location { + /** + * Get the offset for a line and column based position in the bound file. + * Returns `-1` when given invalid or out of bounds input. + */ + toOffset: (point: PositionalPoint) => Offset + + /** + * Get the line and column-based point for offset in the bound file. + */ + toPoint: (offset: Offset) => FullPoint + /** @deprecated */ + toPosition: (offset: Offset) => FullPoint + } +} + +/** + * Get transform functions for the given `document`. + */ +declare function vfileLocation(document: string | VFile): vfileLocation.Location + +export = vfileLocation diff --git a/node_modules/remark-lint-link-title-style/package.json b/node_modules/remark-lint-link-title-style/package.json new file mode 100644 index 00000000..5c88918b --- /dev/null +++ b/node_modules/remark-lint-link-title-style/package.json @@ -0,0 +1,77 @@ +{ + "_from": "remark-lint-link-title-style@^2.0.0", + "_id": "remark-lint-link-title-style@2.0.1", + "_inBundle": false, + "_integrity": "sha512-+Q7Ew8qpOQzjqbDF6sUHmn9mKgje+m2Ho8Xz7cEnGIRaKJgtJzkn/dZqQM/az0gn3zaN6rOuwTwqw4EsT5EsIg==", + "_location": "/remark-lint-link-title-style", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-link-title-style@^2.0.0", + "name": "remark-lint-link-title-style", + "escapedName": "remark-lint-link-title-style", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-link-title-style/-/remark-lint-link-title-style-2.0.1.tgz", + "_shasum": "51a595c69fcfa73a245a030dfaa3504938a1173a", + "_spec": "remark-lint-link-title-style@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0", + "vfile-location": "^3.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when link and definition titles occur with incorrect quotes", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "link", + "image", + "definition", + "style" + ], + "license": "MIT", + "name": "remark-lint-link-title-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-link-title-style" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-link-title-style/readme.md b/node_modules/remark-lint-link-title-style/readme.md new file mode 100644 index 00000000..6b40440a --- /dev/null +++ b/node_modules/remark-lint-link-title-style/readme.md @@ -0,0 +1,268 @@ + + +# remark-lint-link-title-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when link and definition titles occur with incorrect quotes. + +Options: `'consistent'`, `'"'`, `'\''`, or `'()'`, default: `'consistent'`. + +`'consistent'` detects the first used quote style and warns when subsequent +titles use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +uses `'` (single quote) for titles if they contain a double quote, and `"` +(double quotes) otherwise. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'"'` | + +## Example + +##### `ok.md` + +When configured with `'"'`. + +###### In + +```markdown +[Example](http://example.com#without-title) +[Example](http://example.com "Example Domain") +![Example](http://example.com "Example Domain") + +[Example]: http://example.com "Example Domain" + +You can use parens in URLs if they’re not a title (see GH-166): + +[Example](#Heading-(optional)) +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'"'`. + +###### In + +```markdown +[Example]: http://example.com 'Example Domain' +``` + +###### Out + +```text +1:31-1:47: Titles should use `"` as a quote +``` + +##### `ok.md` + +When configured with `"'"`. + +###### In + +```markdown +[Example](http://example.com#without-title) +[Example](http://example.com 'Example Domain') +![Example](http://example.com 'Example Domain') + +[Example]: http://example.com 'Example Domain' +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `"'"`. + +###### In + +```markdown +[Example]: http://example.com "Example Domain" +``` + +###### Out + +```text +1:31-1:47: Titles should use `'` as a quote +``` + +##### `ok.md` + +When configured with `'()'`. + +###### In + +```markdown +[Example](http://example.com#without-title) +[Example](http://example.com (Example Domain)) +![Example](http://example.com (Example Domain)) + +[Example]: http://example.com (Example Domain) +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'()'`. + +###### In + +```markdown +[Example](http://example.com 'Example Domain') +``` + +###### Out + +```text +1:30-1:46: Titles should use `()` as a quote +``` + +##### `not-ok.md` + +###### In + +```markdown +[Example](http://example.com "Example Domain") +[Example](http://example.com 'Example Domain') +``` + +###### Out + +```text +2:30-2:46: Titles should use `"` as a quote +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect link title style marker `💩`: use either `'consistent'`, `'"'`, `'\''`, or `'()'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-link-title-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-link-title-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-link-title-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-link-title-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-link-title-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-link-title-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-link-title-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-link-title-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-list-item-bullet-indent/index.js b/node_modules/remark-lint-list-item-bullet-indent/index.js new file mode 100644 index 00000000..f429f90b --- /dev/null +++ b/node_modules/remark-lint-list-item-bullet-indent/index.js @@ -0,0 +1,85 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module list-item-bullet-indent + * @fileoverview + * Warn when list item bullets are indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * removes all indentation before bullets. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Paragraph. + * + * * List item + * * List item + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Paragraph. + * + * ·* List item + * ·* List item + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:3: Incorrect indentation before bullet: remove 1 space + * 4:3: Incorrect indentation before bullet: remove 1 space + */ + +'use strict' + +var rule = require('unified-lint-rule') +var plural = require('plur') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:list-item-bullet-indent', + listItemBulletIndent +) + +var start = position.start + +function listItemBulletIndent(tree, file) { + var contents = String(file) + + visit(tree, 'list', visitor) + + function visitor(node) { + node.children.forEach(visitItems) + } + + function visitItems(item) { + var final + var indent + var reason + + if (!generated(item)) { + final = start(item.children[0]) + indent = contents.slice(start(item).offset, final.offset).match(/^\s*/)[0] + .length + + if (indent !== 0) { + reason = + 'Incorrect indentation before bullet: remove ' + + indent + + ' ' + + plural('space', indent) + + file.message(reason, { + line: final.line, + column: final.column - indent + }) + } + } + } +} diff --git a/node_modules/remark-lint-list-item-bullet-indent/package.json b/node_modules/remark-lint-list-item-bullet-indent/package.json new file mode 100644 index 00000000..d27b4993 --- /dev/null +++ b/node_modules/remark-lint-list-item-bullet-indent/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-list-item-bullet-indent@^1.0.0", + "_id": "remark-lint-list-item-bullet-indent@1.0.4", + "_inBundle": false, + "_integrity": "sha512-SqhAmVFkeFQYP5I1qztCi2rfhLWwfSvia3DZ56sz9+h1pMqWIj3FmWRueY36xrnQo3LxsLljM5atI7AJBWxQEw==", + "_location": "/remark-lint-list-item-bullet-indent", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-list-item-bullet-indent@^1.0.0", + "name": "remark-lint-list-item-bullet-indent", + "escapedName": "remark-lint-list-item-bullet-indent", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-list-item-bullet-indent/-/remark-lint-list-item-bullet-indent-1.0.4.tgz", + "_shasum": "dd9a0de0109674731e12be109a639b8135c517a1", + "_spec": "remark-lint-list-item-bullet-indent@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-recommended", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when list item bullets are indented", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "list", + "item", + "indent" + ], + "license": "MIT", + "name": "remark-lint-list-item-bullet-indent", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-bullet-indent" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-list-item-bullet-indent/readme.md b/node_modules/remark-lint-list-item-bullet-indent/readme.md new file mode 100644 index 00000000..53ce0308 --- /dev/null +++ b/node_modules/remark-lint-list-item-bullet-indent/readme.md @@ -0,0 +1,165 @@ + + +# remark-lint-list-item-bullet-indent + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when list item bullets are indented. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +removes all indentation before bullets. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +Paragraph. + +* List item +* List item +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +Paragraph. + +·* List item +·* List item +``` + +###### Out + +```text +3:3: Incorrect indentation before bullet: remove 1 space +4:3: Incorrect indentation before bullet: remove 1 space +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-list-item-bullet-indent +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-list-item-bullet-indent", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-list-item-bullet-indent readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-list-item-bullet-indent')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-list-item-bullet-indent.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-list-item-bullet-indent + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-list-item-bullet-indent.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-list-item-bullet-indent + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-list-item-content-indent/index.js b/node_modules/remark-lint-list-item-content-indent/index.js new file mode 100644 index 00000000..c6685dc8 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/index.js @@ -0,0 +1,105 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module list-item-content-indent + * @fileoverview + * Warn when the content of a list item has mixed indentation. + * + * @example {"name": "ok.md"} + * + * 1.·[x] Alpha + * ···1. Bravo + * + * @example {"name": "not-ok.md", "label": "input"} + * + * 1.·[x] Charlie + * ····1. Delta + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:5: Don’t use mixed indentation for children, remove 1 space + */ + +'use strict' + +var rule = require('unified-lint-rule') +var plural = require('pluralize') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:list-item-content-indent', + listItemContentIndent +) + +var start = position.start + +function listItemContentIndent(tree, file) { + var contents = String(file) + + visit(tree, 'listItem', visitor) + + function visitor(node) { + var style + + node.children.forEach(visitItem) + + function visitItem(item, index) { + var begin + var column + var char + var diff + var reason + var abs + + if (generated(item)) { + return + } + + begin = start(item) + column = begin.column + + // Get indentation for the first child. Only the first item can have a + // checkbox, so here we remove that from the column. + if (index === 0) { + // If there’s a checkbox before the content, look backwards to find the + // start of that checkbox. + if (typeof node.checked === 'boolean') { + char = begin.offset - 1 + + while (contents.charAt(char) !== '[') { + char-- + } + + column -= begin.offset - char + } + + style = column + + return + } + + // Warn for violating children. + if (column !== style) { + diff = style - column + abs = Math.abs(diff) + + reason = + 'Don’t use mixed indentation for children, ' + + /* istanbul ignore next - hard to test, I couldn’t find it at least. */ + (diff > 0 ? 'add' : 'remove') + + ' ' + + abs + + ' ' + + plural('space', abs) + + file.message(reason, { + line: start(item).line, + column: column + }) + } + } + } +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/index.js b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/license b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-list-item-content-indent/node_modules/unist-util-is/package.json b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..ef7959cf --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-list-item-content-indent/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-list-item-content-indent/unist-util-visit", + "/remark-lint-list-item-content-indent/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..63d9552f --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-list-item-content-indent/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-list-item-content-indent/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/license b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-list-item-content-indent/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..d71dffa5 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-list-item-content-indent/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-list-item-content-indent" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-list-item-content-indent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-list-item-content-indent/package.json b/node_modules/remark-lint-list-item-content-indent/package.json new file mode 100644 index 00000000..62ce1e2e --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/package.json @@ -0,0 +1,77 @@ +{ + "_from": "remark-lint-list-item-content-indent@^2.0.0", + "_id": "remark-lint-list-item-content-indent@2.0.1", + "_inBundle": false, + "_integrity": "sha512-OzUMqavxyptAdG7vWvBSMc9mLW9ZlTjbW4XGayzczd3KIr6Uwp3NEFXKx6MLtYIM/vwBqMrPQUrObOC7A2uBpQ==", + "_location": "/remark-lint-list-item-content-indent", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-list-item-content-indent@^2.0.0", + "name": "remark-lint-list-item-content-indent", + "escapedName": "remark-lint-list-item-content-indent", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-list-item-content-indent/-/remark-lint-list-item-content-indent-2.0.1.tgz", + "_shasum": "96387459440dcd61e522ab02bff138b32bfaa63a", + "_spec": "remark-lint-list-item-content-indent@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "pluralize": "^8.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when the content of a list item has mixed indentation", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "list", + "item", + "content", + "indent" + ], + "license": "MIT", + "name": "remark-lint-list-item-content-indent", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-content-indent" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-list-item-content-indent/readme.md b/node_modules/remark-lint-list-item-content-indent/readme.md new file mode 100644 index 00000000..836bd07c --- /dev/null +++ b/node_modules/remark-lint-list-item-content-indent/readme.md @@ -0,0 +1,155 @@ + + +# remark-lint-list-item-content-indent + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the content of a list item has mixed indentation. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +1.·[x] Alpha +···1. Bravo +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +1.·[x] Charlie +····1. Delta +``` + +###### Out + +```text +2:5: Don’t use mixed indentation for children, remove 1 space +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-list-item-content-indent +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-list-item-content-indent", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-list-item-content-indent readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-list-item-content-indent')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-list-item-content-indent.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-list-item-content-indent + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-list-item-content-indent.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-list-item-content-indent + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-list-item-indent/index.js b/node_modules/remark-lint-list-item-indent/index.js new file mode 100644 index 00000000..7a1db2ce --- /dev/null +++ b/node_modules/remark-lint-list-item-indent/index.js @@ -0,0 +1,176 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module list-item-indent + * @fileoverview + * Warn when the spacing between a list item’s bullet and its content violates + * a given style. + * + * Options: `'tab-size'`, `'mixed'`, or `'space'`, default: `'tab-size'`. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * uses `'tab-size'` (named `'tab'` there) by default to ensure Markdown is + * seen the same way across vendors. + * This can be configured with the + * [`listItemIndent`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionslistitemindent) + * option. + * This rule’s `'space'` option is named `'1'` there. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * *···List + * ····item. + * + * Paragraph. + * + * 11.·List + * ····item. + * + * Paragraph. + * + * *···List + * ····item. + * + * *···List + * ····item. + * + * @example {"name": "ok.md", "setting": "mixed"} + * + * *·List item. + * + * Paragraph. + * + * 11.·List item + * + * Paragraph. + * + * *···List + * ····item. + * + * *···List + * ····item. + * + * @example {"name": "ok.md", "setting": "space"} + * + * *·List item. + * + * Paragraph. + * + * 11.·List item + * + * Paragraph. + * + * *·List + * ··item. + * + * *·List + * ··item. + * + * @example {"name": "not-ok.md", "setting": "space", "label": "input"} + * + * *···List + * ····item. + * + * @example {"name": "not-ok.md", "setting": "space", "label": "output"} + * + * 1:5: Incorrect list-item indent: remove 2 spaces + * + * @example {"name": "not-ok.md", "setting": "tab-size", "label": "input"} + * + * *·List + * ··item. + * + * @example {"name": "not-ok.md", "setting": "tab-size", "label": "output"} + * + * 1:3: Incorrect list-item indent: add 2 spaces + * + * @example {"name": "not-ok.md", "setting": "mixed", "label": "input"} + * + * *···List item. + * + * @example {"name": "not-ok.md", "setting": "mixed", "label": "output"} + * + * 1:5: Incorrect list-item indent: remove 2 spaces + * + * @example {"name": "not-ok.md", "setting": "💩", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect list-item indent style `💩`: use either `'tab-size'`, `'space'`, or `'mixed'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var plural = require('plur') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:list-item-indent', listItemIndent) + +var start = position.start + +var styles = {'tab-size': true, mixed: true, space: true} + +function listItemIndent(tree, file, option) { + var contents = String(file) + var preferred = typeof option === 'string' ? option : 'tab-size' + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect list-item indent style `' + + preferred + + "`: use either `'tab-size'`, `'space'`, or `'mixed'`" + ) + } + + visit(tree, 'list', visitor) + + function visitor(node) { + var spread = node.spread || node.loose + + if (!generated(node)) { + node.children.forEach(visitItem) + } + + function visitItem(item) { + var head = item.children[0] + var final = start(head) + var marker + var bulletSize + var style + var diff + var reason + + marker = contents + .slice(start(item).offset, final.offset) + .replace(/\[[x ]?]\s*$/i, '') + + bulletSize = marker.replace(/\s+$/, '').length + + style = + preferred === 'tab-size' || (preferred === 'mixed' && spread) + ? Math.ceil(bulletSize / 4) * 4 + : bulletSize + 1 + + if (marker.length !== style) { + diff = style - marker.length + + reason = + 'Incorrect list-item indent: ' + + (diff > 0 ? 'add' : 'remove') + + ' ' + + Math.abs(diff) + + ' ' + + plural('space', diff) + + file.message(reason, final) + } + } + } +} diff --git a/node_modules/remark-lint-list-item-indent/package.json b/node_modules/remark-lint-list-item-indent/package.json new file mode 100644 index 00000000..3db61877 --- /dev/null +++ b/node_modules/remark-lint-list-item-indent/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-list-item-indent@^1.0.0", + "_id": "remark-lint-list-item-indent@1.0.5", + "_inBundle": false, + "_integrity": "sha512-DjRgxjqaVMrnlQFJypizTPtLa9gSM5ad0LVIFDSstV2UVXSgpBi2+bSsFJEXb4Fkjo/d2JAgt27UhzhcoF2lnw==", + "_location": "/remark-lint-list-item-indent", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-list-item-indent@^1.0.0", + "name": "remark-lint-list-item-indent", + "escapedName": "remark-lint-list-item-indent", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-list-item-indent/-/remark-lint-list-item-indent-1.0.5.tgz", + "_shasum": "873c51c24ec673af0816347ecf941361a04b1ff4", + "_spec": "remark-lint-list-item-indent@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when the spacing between a list item’s bullet and its content violates a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "list", + "item", + "indent" + ], + "license": "MIT", + "name": "remark-lint-list-item-indent", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-indent" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-list-item-indent/readme.md b/node_modules/remark-lint-list-item-indent/readme.md new file mode 100644 index 00000000..ead687f1 --- /dev/null +++ b/node_modules/remark-lint-list-item-indent/readme.md @@ -0,0 +1,289 @@ + + +# remark-lint-list-item-indent + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the spacing between a list item’s bullet and its content violates +a given style. + +Options: `'tab-size'`, `'mixed'`, or `'space'`, default: `'tab-size'`. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +uses `'tab-size'` (named `'tab'` there) by default to ensure Markdown is +seen the same way across vendors. +This can be configured with the +[`listItemIndent`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionslistitemindent) +option. +This rule’s `'space'` option is named `'1'` there. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'mixed'` | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | `'tab-size'` | + +## Example + +##### `ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +*···List +····item. + +Paragraph. + +11.·List +····item. + +Paragraph. + +*···List +····item. + +*···List +····item. +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'mixed'`. + +###### In + +Note: `·` represents a space. + +```markdown +*·List item. + +Paragraph. + +11.·List item + +Paragraph. + +*···List +····item. + +*···List +····item. +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'mixed'`. + +###### In + +Note: `·` represents a space. + +```markdown +*···List item. +``` + +###### Out + +```text +1:5: Incorrect list-item indent: remove 2 spaces +``` + +##### `ok.md` + +When configured with `'space'`. + +###### In + +Note: `·` represents a space. + +```markdown +*·List item. + +Paragraph. + +11.·List item + +Paragraph. + +*·List +··item. + +*·List +··item. +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'space'`. + +###### In + +Note: `·` represents a space. + +```markdown +*···List +····item. +``` + +###### Out + +```text +1:5: Incorrect list-item indent: remove 2 spaces +``` + +##### `not-ok.md` + +When configured with `'tab-size'`. + +###### In + +Note: `·` represents a space. + +```markdown +*·List +··item. +``` + +###### Out + +```text +1:3: Incorrect list-item indent: add 2 spaces +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect list-item indent style `💩`: use either `'tab-size'`, `'space'`, or `'mixed'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-list-item-indent +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-list-item-indent", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-list-item-indent readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-list-item-indent')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-list-item-indent.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-list-item-indent + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-list-item-indent.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-list-item-indent + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-list-item-spacing/index.js b/node_modules/remark-lint-list-item-spacing/index.js new file mode 100644 index 00000000..d7a13f84 --- /dev/null +++ b/node_modules/remark-lint-list-item-spacing/index.js @@ -0,0 +1,198 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module list-item-spacing + * @fileoverview + * Warn when list looseness is incorrect, such as being tight when it should + * be loose, and vice versa. + * + * According to the [`markdown-style-guide`](http://www.cirosantilli.com/markdown-style-guide/), + * if one or more list items in a list spans more than one line, the list is + * required to have blank lines between each item. + * And otherwise, there should not be blank lines between items. + * + * By default, all items must be “loose” (a blank line must be between them) + * if one or more items are multiline (span more than one line). + * Otherwise, the list must be tight (no blank line must be between items). + * + * If you pass `{checkBlanks: true}`, all items must be “loose” if one or more + * items contain blank lines. + * Otherwise, the list must be tight. + * + * @example {"name": "ok.md"} + * + * A tight list: + * + * - item 1 + * - item 2 + * - item 3 + * + * A loose list: + * + * - Wrapped + * item + * + * - item 2 + * + * - item 3 + * + * @example {"name": "not-ok.md", "label": "input"} + * + * A tight list: + * + * - Wrapped + * item + * - item 2 + * - item 3 + * + * A loose list: + * + * - item 1 + * + * - item 2 + * + * - item 3 + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 4:9-5:1: Missing new line after list item + * 5:11-6:1: Missing new line after list item + * 11:1-12:1: Extraneous new line after list item + * 13:1-14:1: Extraneous new line after list item + * + * @example {"name": "ok.md", "setting": {"checkBlanks": true}} + * + * A tight list: + * + * - item 1 + * - item 1.A + * - item 2 + * > Block quote + * + * A loose list: + * + * - item 1 + * + * - item 1.A + * + * - item 2 + * + * > Block quote + * + * @example {"name": "not-ok.md", "setting": {"checkBlanks": true}, "label": "input"} + * + * A tight list: + * + * - item 1 + * + * - item 1.A + * - item 2 + * + * > Block quote + * - item 3 + * + * A loose list: + * + * - item 1 + * - item 1.A + * + * - item 2 + * > Block quote + * + * @example {"name": "not-ok.md", "setting": {"checkBlanks": true}, "label": "output"} + * + * 5:15-6:1: Missing new line after list item + * 8:18-9:1: Missing new line after list item + * 15:1-16:1: Extraneous new line after list item + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:list-item-spacing', listItemSpacing) + +var start = position.start +var end = position.end + +var reasonLoose = 'Missing new line after list item' +var reasonTight = 'Extraneous new line after list item' + +function listItemSpacing(tree, file, option) { + var infer = + option && typeof option === 'object' && option.checkBlanks + ? inferBlankLine + : inferMultiline + + visit(tree, 'list', visitor) + + function visitor(node) { + var tight = true + var indent + var children + var length + var index + var child + var next + + if (!generated(node)) { + children = node.children + length = children.length + index = -1 + + while (++index < length) { + if (infer(children[index])) { + tight = false + break + } + } + + indent = start(node).column + child = children[0] + index = 0 + + while (++index < length) { + next = children[index] + + if (end(child).column > indent !== tight) { + file.message(tight ? reasonTight : reasonLoose, { + start: end(child), + end: start(next) + }) + } + + child = next + } + } + } +} + +function inferBlankLine(node) { + var children = node.children + var child = children[0] + var length = children.length + var index = 0 + var next + + while (++index < length) { + next = children[index] + + // All children in `listItem`s are block. + if (start(next).line - end(child).line > 1) { + return true + } + + child = next + } + + return false +} + +function inferMultiline(node) { + var children = node.children + return end(children[children.length - 1]).line - start(children[0]).line > 0 +} diff --git a/node_modules/remark-lint-list-item-spacing/package.json b/node_modules/remark-lint-list-item-spacing/package.json new file mode 100644 index 00000000..89613e13 --- /dev/null +++ b/node_modules/remark-lint-list-item-spacing/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-list-item-spacing@^1.0.0", + "_id": "remark-lint-list-item-spacing@1.1.4", + "_inBundle": false, + "_integrity": "sha512-zZELzTPYCoOCnOWh/nYTfQWnGXWg4/I5KpwrjBqe7WYwoMtvLVU9mqjRj2jHEbmirEXas54NZnYnkCoIBMS4bw==", + "_location": "/remark-lint-list-item-spacing", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-list-item-spacing@^1.0.0", + "name": "remark-lint-list-item-spacing", + "escapedName": "remark-lint-list-item-spacing", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-list-item-spacing/-/remark-lint-list-item-spacing-1.1.4.tgz", + "_shasum": "ea0df16f8378ef6414a2473755ade9544adc0888", + "_spec": "remark-lint-list-item-spacing@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when list looseness is incorrect", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "list", + "item", + "loose", + "tight" + ], + "license": "MIT", + "name": "remark-lint-list-item-spacing", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-spacing" + }, + "version": "1.1.4", + "xo": false +} diff --git a/node_modules/remark-lint-list-item-spacing/readme.md b/node_modules/remark-lint-list-item-spacing/readme.md new file mode 100644 index 00000000..eae66269 --- /dev/null +++ b/node_modules/remark-lint-list-item-spacing/readme.md @@ -0,0 +1,254 @@ + + +# remark-lint-list-item-spacing + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when list looseness is incorrect, such as being tight when it should +be loose, and vice versa. + +According to the [`markdown-style-guide`](http://www.cirosantilli.com/markdown-style-guide/), +if one or more list items in a list spans more than one line, the list is +required to have blank lines between each item. +And otherwise, there should not be blank lines between items. + +By default, all items must be “loose” (a blank line must be between them) +if one or more items are multiline (span more than one line). +Otherwise, the list must be tight (no blank line must be between items). + +If you pass `{checkBlanks: true}`, all items must be “loose” if one or more +items contain blank lines. +Otherwise, the list must be tight. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +A tight list: + +- item 1 +- item 2 +- item 3 + +A loose list: + +- Wrapped + item + +- item 2 + +- item 3 +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +A tight list: + +- Wrapped + item +- item 2 +- item 3 + +A loose list: + +- item 1 + +- item 2 + +- item 3 +``` + +###### Out + +```text +4:9-5:1: Missing new line after list item +5:11-6:1: Missing new line after list item +11:1-12:1: Extraneous new line after list item +13:1-14:1: Extraneous new line after list item +``` + +##### `ok.md` + +When configured with `{ checkBlanks: true }`. + +###### In + +```markdown +A tight list: + +- item 1 + - item 1.A +- item 2 + > Block quote + +A loose list: + +- item 1 + + - item 1.A + +- item 2 + + > Block quote +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `{ checkBlanks: true }`. + +###### In + +```markdown +A tight list: + +- item 1 + + - item 1.A +- item 2 + + > Block quote +- item 3 + +A loose list: + +- item 1 + - item 1.A + +- item 2 + > Block quote +``` + +###### Out + +```text +5:15-6:1: Missing new line after list item +8:18-9:1: Missing new line after list item +15:1-16:1: Extraneous new line after list item +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-list-item-spacing +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-list-item-spacing", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-list-item-spacing readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-list-item-spacing')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-list-item-spacing.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-list-item-spacing + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-list-item-spacing.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-list-item-spacing + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-maximum-heading-length/index.js b/node_modules/remark-lint-maximum-heading-length/index.js new file mode 100644 index 00000000..a63ac3cc --- /dev/null +++ b/node_modules/remark-lint-maximum-heading-length/index.js @@ -0,0 +1,50 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module maximum-heading-length + * @fileoverview + * Warn when headings are too long. + * + * Options: `number`, default: `60`. + * + * Ignores Markdown syntax, only checks the plain text content. + * + * @example {"name": "ok.md"} + * + * # Alpha bravo charlie delta echo foxtrot golf hotel + * + * # ![Alpha bravo charlie delta echo foxtrot golf hotel](http://example.com/nato.png) + * + * @example {"name": "not-ok.md", "setting": 40, "label": "input"} + * + * # Alpha bravo charlie delta echo foxtrot golf hotel + * + * @example {"name": "not-ok.md", "setting": 40, "label": "output"} + * + * 1:1-1:52: Use headings shorter than `40` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var generated = require('unist-util-generated') +var toString = require('mdast-util-to-string') + +module.exports = rule( + 'remark-lint:maximum-heading-length', + maximumHeadingLength +) + +function maximumHeadingLength(tree, file, option) { + var preferred = typeof option === 'number' && !isNaN(option) ? option : 60 + + visit(tree, 'heading', visitor) + + function visitor(node) { + if (!generated(node) && toString(node).length > preferred) { + file.message('Use headings shorter than `' + preferred + '`', node) + } + } +} diff --git a/node_modules/remark-lint-maximum-heading-length/package.json b/node_modules/remark-lint-maximum-heading-length/package.json new file mode 100644 index 00000000..f65eaaee --- /dev/null +++ b/node_modules/remark-lint-maximum-heading-length/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-maximum-heading-length@^1.0.0", + "_id": "remark-lint-maximum-heading-length@1.0.4", + "_inBundle": false, + "_integrity": "sha512-dhDBnUFXMuHoW8LSV/VICJAJO+wWumnvuu3ND7MJquCYrsjX2vcRmJXL5cusJSY4yqPosKlOowIkzdV5B6/SDQ==", + "_location": "/remark-lint-maximum-heading-length", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-maximum-heading-length@^1.0.0", + "name": "remark-lint-maximum-heading-length", + "escapedName": "remark-lint-maximum-heading-length", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-maximum-heading-length/-/remark-lint-maximum-heading-length-1.0.4.tgz", + "_shasum": "49f6d2df870dcf993c053a67fb82344d5aac0af8", + "_spec": "remark-lint-maximum-heading-length@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when headings are too long", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "heading", + "length" + ], + "license": "MIT", + "name": "remark-lint-maximum-heading-length", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-maximum-heading-length" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-maximum-heading-length/readme.md b/node_modules/remark-lint-maximum-heading-length/readme.md new file mode 100644 index 00000000..045ac77b --- /dev/null +++ b/node_modules/remark-lint-maximum-heading-length/readme.md @@ -0,0 +1,156 @@ + + +# remark-lint-maximum-heading-length + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when headings are too long. + +Options: `number`, default: `60`. + +Ignores Markdown syntax, only checks the plain text content. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `not-ok.md` + +When configured with `40`. + +###### In + +```markdown +# Alpha bravo charlie delta echo foxtrot golf hotel +``` + +###### Out + +```text +1:1-1:52: Use headings shorter than `40` +``` + +##### `ok.md` + +###### In + +```markdown +# Alpha bravo charlie delta echo foxtrot golf hotel + +# ![Alpha bravo charlie delta echo foxtrot golf hotel](http://example.com/nato.png) +``` + +###### Out + +No messages. + +## Install + +[npm][]: + +```sh +npm install remark-lint-maximum-heading-length +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-maximum-heading-length", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-maximum-heading-length readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-maximum-heading-length')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-maximum-heading-length.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-maximum-heading-length + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-maximum-heading-length.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-maximum-heading-length + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-maximum-line-length/index.js b/node_modules/remark-lint-maximum-line-length/index.js new file mode 100644 index 00000000..98a83c8d --- /dev/null +++ b/node_modules/remark-lint-maximum-line-length/index.js @@ -0,0 +1,176 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module maximum-line-length + * @fileoverview + * Warn when lines are too long. + * + * Options: `number`, default: `80`. + * + * Ignores nodes that cannot be wrapped, such as headings, tables, code, + * definitions, HTML, and JSX. + * + * Ignores images, links, and inline code if they start before the wrap, end + * after the wrap, and there’s no whitespace after them. + * + * @example {"name": "ok.md", "config": {"positionless": true}} + * + * This line is simply not toooooooooooooooooooooooooooooooooooooooooooo + * long. + * + * This is also fine: + * + * + * + * `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()` + * + * [foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) + * + * + * + * ![foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) + * + * | An | exception | is | line | length | in | long | tables | because | those | can’t | just | + * | -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- | + * | be | helped | | | | | | | | | | . | + * + *

alpha bravo charlie delta echo foxtrot golf

+ * + * The following is also fine, because there is no whitespace. + * + * . + * + * In addition, definitions are also fine: + * + * [foo]: + * + * @example {"name": "not-ok.md", "setting": 80, "label": "input", "config": {"positionless": true}} + * + * This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo + * long. + * + * Just like thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis one. + * + * And this one is also very wrong: because the link starts aaaaaaafter the column: + * + * and such. + * + * And this one is also very wrong: because the code starts aaaaaaafter the column: `alpha.bravo()` + * + * `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such. + * + * @example {"name": "not-ok.md", "setting": 80, "label": "output", "config": {"positionless": true}} + * + * 4:86: Line must be at most 80 characters + * 6:99: Line must be at most 80 characters + * 8:96: Line must be at most 80 characters + * 10:97: Line must be at most 80 characters + * 12:99: Line must be at most 80 characters + * + * @example {"name": "ok-mixed-line-endings.md", "setting": 10, "config": {"positionless": true}} + * + * 0123456789␍␊ + * 0123456789␊ + * 01234␍␊ + * 01234␊ + * + * @example {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "input", "config": {"positionless": true}} + * + * 012345678901␍␊ + * 012345678901␊ + * 01234567890␍␊ + * 01234567890␊ + * + * @example {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "output", "config": {"positionless": true}} + * + * 1:13: Line must be at most 10 characters + * 2:13: Line must be at most 10 characters + * 3:12: Line must be at most 10 characters + * 4:12: Line must be at most 10 characters + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:maximum-line-length', maximumLineLength) + +var start = position.start +var end = position.end + +function maximumLineLength(tree, file, option) { + var preferred = typeof option === 'number' && !isNaN(option) ? option : 80 + var content = String(file) + var lines = content.split(/\r?\n/) + var length = lines.length + var index = -1 + var lineLength + + // Note: JSX is from MDX: . + visit(tree, ['heading', 'table', 'code', 'definition', 'html', 'jsx'], ignore) + visit(tree, ['link', 'image', 'inlineCode'], inline) + + // Iterate over every line, and warn for violating lines. + while (++index < length) { + lineLength = lines[index].length + + if (lineLength > preferred) { + file.message('Line must be at most ' + preferred + ' characters', { + line: index + 1, + column: lineLength + 1 + }) + } + } + + // Finally, whitelist some inline spans, but only if they occur at or after + // the wrap. + // However, when they do, and there’s whitespace after it, they are not + // whitelisted. + function inline(node, pos, parent) { + var next = parent.children[pos + 1] + var initial + var final + + /* istanbul ignore if - Nothing to whitelist when generated. */ + if (generated(node)) { + return + } + + initial = start(node) + final = end(node) + + // No whitelisting when starting after the border, or ending before it. + if (initial.column > preferred || final.column < preferred) { + return + } + + // No whitelisting when there’s whitespace after the link. + if ( + next && + start(next).line === initial.line && + (!next.value || /^(.+?[ \t].+?)/.test(next.value)) + ) { + return + } + + whitelist(initial.line - 1, final.line) + } + + function ignore(node) { + /* istanbul ignore else - Hard to test, as we only run this case on `position: true` */ + if (!generated(node)) { + whitelist(start(node).line - 1, end(node).line) + } + } + + // Whitelist from `initial` to `final`, zero-based. + function whitelist(initial, final) { + while (initial < final) { + lines[initial++] = '' + } + } +} diff --git a/node_modules/remark-lint-maximum-line-length/package.json b/node_modules/remark-lint-maximum-line-length/package.json new file mode 100644 index 00000000..3a98fe63 --- /dev/null +++ b/node_modules/remark-lint-maximum-line-length/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-maximum-line-length@^1.0.0", + "_id": "remark-lint-maximum-line-length@1.2.2", + "_inBundle": false, + "_integrity": "sha512-ItAdjK+tUhqggqFvtAJ8iJ0MbBgShLl0HDgpG3In0QSYp/dmofO77DjvRjCJQo1pQYS8/LwlBii9cqg/3MwFfA==", + "_location": "/remark-lint-maximum-line-length", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-maximum-line-length@^1.0.0", + "name": "remark-lint-maximum-line-length", + "escapedName": "remark-lint-maximum-line-length", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-maximum-line-length/-/remark-lint-maximum-line-length-1.2.2.tgz", + "_shasum": "9bb53292a0d3263596bd84e23007ead081558bd1", + "_spec": "remark-lint-maximum-line-length@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when lines are too long", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "line", + "length" + ], + "license": "MIT", + "name": "remark-lint-maximum-line-length", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-maximum-line-length" + }, + "version": "1.2.2", + "xo": false +} diff --git a/node_modules/remark-lint-maximum-line-length/readme.md b/node_modules/remark-lint-maximum-line-length/readme.md new file mode 100644 index 00000000..8cf2e0da --- /dev/null +++ b/node_modules/remark-lint-maximum-line-length/readme.md @@ -0,0 +1,247 @@ + + +# remark-lint-maximum-line-length + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when lines are too long. + +Options: `number`, default: `80`. + +Ignores nodes that cannot be wrapped, such as headings, tables, code, +definitions, HTML, and JSX. + +Ignores images, links, and inline code if they start before the wrap, end +after the wrap, and there’s no whitespace after them. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `80` | + +## Example + +##### `ok-mixed-line-endings.md` + +When configured with `10`. + +###### In + +Note: `␍␊` represents a carriage return and a line feed. + +Note: `␊` represents a line feed. + +```markdown +0123456789␍␊ +0123456789␊ +01234␍␊ +01234␊ +``` + +###### Out + +No messages. + +##### `not-ok-mixed-line-endings.md` + +When configured with `10`. + +###### In + +Note: `␍␊` represents a carriage return and a line feed. + +Note: `␊` represents a line feed. + +```markdown +012345678901␍␊ +012345678901␊ +01234567890␍␊ +01234567890␊ +``` + +###### Out + +```text +1:13: Line must be at most 10 characters +2:13: Line must be at most 10 characters +3:12: Line must be at most 10 characters +4:12: Line must be at most 10 characters +``` + +##### `not-ok.md` + +When configured with `80`. + +###### In + +```markdown +This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo +long. + +Just like thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis one. + +And this one is also very wrong: because the link starts aaaaaaafter the column: + + and such. + +And this one is also very wrong: because the code starts aaaaaaafter the column: `alpha.bravo()` + +`alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such. +``` + +###### Out + +```text +4:86: Line must be at most 80 characters +6:99: Line must be at most 80 characters +8:96: Line must be at most 80 characters +10:97: Line must be at most 80 characters +12:99: Line must be at most 80 characters +``` + +##### `ok.md` + +###### In + +```markdown +This line is simply not toooooooooooooooooooooooooooooooooooooooooooo +long. + +This is also fine: + + + +`alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()` + +[foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) + + + +![foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) + +| An | exception | is | line | length | in | long | tables | because | those | can’t | just | +| -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- | +| be | helped | | | | | | | | | | . | + +

alpha bravo charlie delta echo foxtrot golf

+ +The following is also fine, because there is no whitespace. + +. + +In addition, definitions are also fine: + +[foo]: +``` + +###### Out + +No messages. + +## Install + +[npm][]: + +```sh +npm install remark-lint-maximum-line-length +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-maximum-line-length", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-maximum-line-length readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-maximum-line-length')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-maximum-line-length.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-maximum-line-length + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-maximum-line-length.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-maximum-line-length + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-auto-link-without-protocol/index.js b/node_modules/remark-lint-no-auto-link-without-protocol/index.js new file mode 100644 index 00000000..7396c569 --- /dev/null +++ b/node_modules/remark-lint-no-auto-link-without-protocol/index.js @@ -0,0 +1,76 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-auto-link-without-protocol + * @fileoverview + * Warn for autolinks without protocol. + * Autolinks are URLs enclosed in `<` (less than) and `>` (greater than) + * characters. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * adds a protocol where needed. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * + * + * + * Most Markdown vendors don’t recognize the following as a link: + * + * + * @example {"name": "not-ok.md", "label": "input"} + * + * + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:14: All automatic links must start with a protocol + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') +var toString = require('mdast-util-to-string') + +module.exports = rule( + 'remark-lint:no-auto-link-without-protocol', + noAutoLinkWithoutProtocol +) + +var start = position.start +var end = position.end + +// Protocol expression. +// See: . +var protocol = /^[a-z][a-z+.-]+:\/?/i + +var reason = 'All automatic links must start with a protocol' + +function noAutoLinkWithoutProtocol(tree, file) { + visit(tree, 'link', visitor) + + function visitor(node) { + var children + + if (!generated(node)) { + children = node.children + + if ( + start(node).column === start(children[0]).column - 1 && + end(node).column === end(children[children.length - 1]).column + 1 && + !protocol.test(toString(node)) + ) { + file.message(reason, node) + } + } + } +} diff --git a/node_modules/remark-lint-no-auto-link-without-protocol/package.json b/node_modules/remark-lint-no-auto-link-without-protocol/package.json new file mode 100644 index 00000000..9cf63e8e --- /dev/null +++ b/node_modules/remark-lint-no-auto-link-without-protocol/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-no-auto-link-without-protocol@^1.0.0", + "_id": "remark-lint-no-auto-link-without-protocol@1.0.4", + "_inBundle": false, + "_integrity": "sha512-dhDHQLeaI79p7SRoKfxJ9c8J5otQsGua7ILeNbs2Onzn46/tp9ir6zjq3Lfh4VJJr4OVign2e8u+MzXsS7Uu/A==", + "_location": "/remark-lint-no-auto-link-without-protocol", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-auto-link-without-protocol@^1.0.0", + "name": "remark-lint-no-auto-link-without-protocol", + "escapedName": "remark-lint-no-auto-link-without-protocol", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-auto-link-without-protocol/-/remark-lint-no-auto-link-without-protocol-1.0.4.tgz", + "_shasum": "c7417ee8f5ab7eb45aa1f7c6a345ff6db1acf843", + "_spec": "remark-lint-no-auto-link-without-protocol@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn for angle bracketed links without protocol", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "auto", + "link", + "protocol" + ], + "license": "MIT", + "name": "remark-lint-no-auto-link-without-protocol", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-auto-link-without-protocol" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-auto-link-without-protocol/readme.md b/node_modules/remark-lint-no-auto-link-without-protocol/readme.md new file mode 100644 index 00000000..0996b606 --- /dev/null +++ b/node_modules/remark-lint-no-auto-link-without-protocol/readme.md @@ -0,0 +1,163 @@ + + +# remark-lint-no-auto-link-without-protocol + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for autolinks without protocol. +Autolinks are URLs enclosed in `<` (less than) and `>` (greater than) +characters. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +adds a protocol where needed. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown + + + +Most Markdown vendors don’t recognize the following as a link: + +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown + +``` + +###### Out + +```text +1:1-1:14: All automatic links must start with a protocol +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-auto-link-without-protocol +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-auto-link-without-protocol", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-auto-link-without-protocol readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-auto-link-without-protocol')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-auto-link-without-protocol.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-auto-link-without-protocol + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-auto-link-without-protocol.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-auto-link-without-protocol + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-blockquote-without-marker/index.js b/node_modules/remark-lint-no-blockquote-without-marker/index.js new file mode 100644 index 00000000..aedd7497 --- /dev/null +++ b/node_modules/remark-lint-no-blockquote-without-marker/index.js @@ -0,0 +1,95 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-blockquote-without-marker + * @fileoverview + * Warn when blank lines without `>` (greater than) markers are found in a + * block quote. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * adds markers to every line in a block quote. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * > Foo… + * > …bar… + * > …baz. + * + * @example {"name": "not-ok.md", "label": "input"} + * + * > Foo… + * …bar… + * > …baz. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:1: Missing marker in block quote + */ + +'use strict' + +var rule = require('unified-lint-rule') +var vfileLocation = require('vfile-location') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:no-blockquote-without-marker', + noBlockquoteWithoutMarker +) + +var reason = 'Missing marker in block quote' + +function noBlockquoteWithoutMarker(tree, file) { + var contents = String(file) + var location = vfileLocation(file) + var last = contents.length + + visit(tree, 'blockquote', visitor) + + function visitor(node) { + var indent = node.position && node.position.indent + var start + var length + var index + var line + var offset + var character + var pos + + if (generated(node) || !indent || indent.length === 0) { + return + } + + start = position.start(node).line + length = indent.length + index = -1 + + while (++index < length) { + line = start + index + 1 + pos = {line: line, column: indent[index]} + offset = location.toOffset(pos) - 1 + + while (++offset < last) { + character = contents.charAt(offset) + + if (character === '>') { + break + } + + /* istanbul ignore else - just for safety */ + if (character !== ' ' && character !== '\t') { + file.message(reason, pos) + break + } + } + } + } +} diff --git a/node_modules/remark-lint-no-blockquote-without-marker/package.json b/node_modules/remark-lint-no-blockquote-without-marker/package.json new file mode 100644 index 00000000..073c02ab --- /dev/null +++ b/node_modules/remark-lint-no-blockquote-without-marker/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-no-blockquote-without-marker@^2.0.0", + "_id": "remark-lint-no-blockquote-without-marker@2.0.4", + "_inBundle": false, + "_integrity": "sha512-a5LFGj7It2z7aBRGaAcztk4D2pax2b7dK9iOarIWv/JBus/PSjZJxzZCma2aAAOQhv3wbNTwqQwuQC0UJHMbPg==", + "_location": "/remark-lint-no-blockquote-without-marker", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-blockquote-without-marker@^2.0.0", + "name": "remark-lint-no-blockquote-without-marker", + "escapedName": "remark-lint-no-blockquote-without-marker", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-2.0.4.tgz", + "_shasum": "96fe200cd738ee2857c82a549622ed999243a990", + "_spec": "remark-lint-no-blockquote-without-marker@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1", + "vfile-location": "^2.0.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when blank lines without markers (`>`) are found in a block quote", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "blockquote", + "caret", + "marker" + ], + "license": "MIT", + "name": "remark-lint-no-blockquote-without-marker", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-blockquote-without-marker" + }, + "version": "2.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-blockquote-without-marker/readme.md b/node_modules/remark-lint-no-blockquote-without-marker/readme.md new file mode 100644 index 00000000..e73f0187 --- /dev/null +++ b/node_modules/remark-lint-no-blockquote-without-marker/readme.md @@ -0,0 +1,162 @@ + + +# remark-lint-no-blockquote-without-marker + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when blank lines without `>` (greater than) markers are found in a +block quote. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +adds markers to every line in a block quote. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +> Foo… +> …bar… +> …baz. +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +> Foo… +…bar… +> …baz. +``` + +###### Out + +```text +2:1: Missing marker in block quote +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-blockquote-without-marker +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-blockquote-without-marker", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-blockquote-without-marker readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-blockquote-without-marker')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-blockquote-without-marker.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-blockquote-without-marker + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-blockquote-without-marker.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-blockquote-without-marker + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-consecutive-blank-lines/index.js b/node_modules/remark-lint-no-consecutive-blank-lines/index.js new file mode 100644 index 00000000..2f5e240c --- /dev/null +++ b/node_modules/remark-lint-no-consecutive-blank-lines/index.js @@ -0,0 +1,129 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-consecutive-blank-lines + * @fileoverview + * Warn for too many consecutive blank lines. + * Knows about the extra line needed between a list and indented code, and two + * lists. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * always uses one blank line between blocks if possible, or two lines when + * needed. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Foo… + * ␊ + * …Bar. + * + * @example {"name": "ok-for-code.md"} + * + * Paragraph. + * + * * List + * ␊ + * ␊ + * bravo(); + * + * @example {"name": "empty-document.md"} + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Foo… + * ␊ + * ␊ + * …Bar + * ␊ + * ␊ + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 4:1: Remove 1 line before node + * 4:5: Remove 2 lines after node + */ + +'use strict' + +var rule = require('unified-lint-rule') +var plural = require('plur') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:no-consecutive-blank-lines', + noConsecutiveBlankLines +) + +function noConsecutiveBlankLines(tree, file) { + visit(tree, visitor) + + function visitor(node) { + var children = node.children + var head + var tail + + if (!generated(node) && children) { + head = children[0] + + if (head && !generated(head)) { + // Compare parent and first child. + compare(position.start(node), position.start(head), 0) + + // Compare between each child. + children.forEach(visitChild) + + tail = children[children.length - 1] + + // Compare parent and last child. + if (tail !== head && !generated(tail)) { + compare(position.end(node), position.end(tail), 1) + } + } + } + } + + // Compare the difference between `start` and `end`, and warn when that + // difference exceeds `max`. + function compare(start, end, max) { + var diff = end.line - start.line + var lines = Math.abs(diff) - max + var reason + + if (lines > 0) { + reason = + 'Remove ' + + lines + + ' ' + + plural('line', lines) + + ' ' + + (diff > 0 ? 'before' : 'after') + + ' node' + + file.message(reason, end) + } + } + + function visitChild(child, index, all) { + var previous = all[index - 1] + var max = 2 + + if (previous && !generated(previous) && !generated(child)) { + if ( + (previous.type === 'list' && child.type === 'list') || + (child.type === 'code' && previous.type === 'list' && !child.lang) + ) { + max++ + } + + compare(position.end(previous), position.start(child), max) + } + } +} diff --git a/node_modules/remark-lint-no-consecutive-blank-lines/package.json b/node_modules/remark-lint-no-consecutive-blank-lines/package.json new file mode 100644 index 00000000..a4f396f7 --- /dev/null +++ b/node_modules/remark-lint-no-consecutive-blank-lines/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-no-consecutive-blank-lines@^1.0.0", + "_id": "remark-lint-no-consecutive-blank-lines@1.0.4", + "_inBundle": false, + "_integrity": "sha512-33rYrp+3OQ2UjG2/xhctruCvkP2iKLuHJhoUOAUV3BGwqJjAB+xNOl+0DdvDo0fxh5dyZuNesBuos3xr2yVR+w==", + "_location": "/remark-lint-no-consecutive-blank-lines", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-consecutive-blank-lines@^1.0.0", + "name": "remark-lint-no-consecutive-blank-lines", + "escapedName": "remark-lint-no-consecutive-blank-lines", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-consecutive-blank-lines/-/remark-lint-no-consecutive-blank-lines-1.0.4.tgz", + "_shasum": "8819e358e9e609360ced6d61e0076ca1a6a2c971", + "_spec": "remark-lint-no-consecutive-blank-lines@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn for too many consecutive blank lines", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "blank", + "lines" + ], + "license": "MIT", + "name": "remark-lint-no-consecutive-blank-lines", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-consecutive-blank-lines" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-consecutive-blank-lines/readme.md b/node_modules/remark-lint-no-consecutive-blank-lines/readme.md new file mode 100644 index 00000000..ec7148b6 --- /dev/null +++ b/node_modules/remark-lint-no-consecutive-blank-lines/readme.md @@ -0,0 +1,196 @@ + + +# remark-lint-no-consecutive-blank-lines + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for too many consecutive blank lines. +Knows about the extra line needed between a list and indented code, and two +lists. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +always uses one blank line between blocks if possible, or two lines when +needed. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +Note: `␊` represents a line feed. + +```markdown +Foo… +␊ +…Bar. +``` + +###### Out + +No messages. + +##### `ok-for-code.md` + +###### In + +Note: `␊` represents a line feed. + +```markdown +Paragraph. + +* List +␊ +␊ + bravo(); +``` + +###### Out + +No messages. + +##### `empty-document.md` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `␊` represents a line feed. + +```markdown +Foo… +␊ +␊ +…Bar +␊ +␊ +``` + +###### Out + +```text +4:1: Remove 1 line before node +4:5: Remove 2 lines after node +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-consecutive-blank-lines +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-consecutive-blank-lines", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-consecutive-blank-lines readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-consecutive-blank-lines')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-consecutive-blank-lines.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-consecutive-blank-lines + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-consecutive-blank-lines.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-consecutive-blank-lines + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-duplicate-definitions/index.js b/node_modules/remark-lint-no-duplicate-definitions/index.js new file mode 100644 index 00000000..c788e83b --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-definitions/index.js @@ -0,0 +1,62 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-duplicate-definitions + * @fileoverview + * Warn when duplicate definitions are found. + * + * @example {"name": "ok.md"} + * + * [foo]: bar + * [baz]: qux + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [foo]: bar + * [foo]: qux + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:1-2:11: Do not use definitions with the same identifier (1:1) + */ + +'use strict' + +var rule = require('unified-lint-rule') +var position = require('unist-util-position') +var generated = require('unist-util-generated') +var stringify = require('unist-util-stringify-position') +var visit = require('unist-util-visit') + +module.exports = rule( + 'remark-lint:no-duplicate-definitions', + noDuplicateDefinitions +) + +var reason = 'Do not use definitions with the same identifier' + +function noDuplicateDefinitions(tree, file) { + var map = {} + + visit(tree, ['definition', 'footnoteDefinition'], check) + + function check(node) { + var identifier + var duplicate + + if (!generated(node)) { + identifier = node.identifier + duplicate = map[identifier] + + if (duplicate && duplicate.type) { + file.message( + reason + ' (' + stringify(position.start(duplicate)) + ')', + node + ) + } + + map[identifier] = node + } + } +} diff --git a/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/index.js b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/index.js new file mode 100644 index 00000000..3d78a444 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/index.js @@ -0,0 +1,50 @@ +'use strict' + +var own = {}.hasOwnProperty + +module.exports = stringify + +function stringify(value) { + // Nothing. + if (!value || typeof value !== 'object') { + return '' + } + + // Node. + if (own.call(value, 'position') || own.call(value, 'type')) { + return position(value.position) + } + + // Position. + if (own.call(value, 'start') || own.call(value, 'end')) { + return position(value) + } + + // Point. + if (own.call(value, 'line') || own.call(value, 'column')) { + return point(value) + } + + // ? + return '' +} + +function point(point) { + if (!point || typeof point !== 'object') { + point = {} + } + + return index(point.line) + ':' + index(point.column) +} + +function position(pos) { + if (!pos || typeof pos !== 'object') { + pos = {} + } + + return point(pos.start) + '-' + point(pos.end) +} + +function index(value) { + return value && typeof value === 'number' ? value : 1 +} diff --git a/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/license b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/package.json b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/package.json new file mode 100644 index 00000000..055d6ec6 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/package.json @@ -0,0 +1,123 @@ +{ + "_from": "unist-util-stringify-position@^2.0.0", + "_id": "unist-util-stringify-position@2.0.3", + "_inBundle": false, + "_integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", + "_location": "/remark-lint-no-duplicate-definitions/unist-util-stringify-position", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-stringify-position@^2.0.0", + "name": "unist-util-stringify-position", + "escapedName": "unist-util-stringify-position", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-no-duplicate-definitions" + ], + "_resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", + "_shasum": "cce3bfa1cdf85ba7375d1d5b17bdc4cada9bd9da", + "_spec": "unist-util-stringify-position@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-no-duplicate-definitions", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-stringify-position/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.2" + }, + "deprecated": false, + "description": "unist utility to serialize a node, position, or point as a human readable location", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "xo": "^0.27.0" + }, + "files": [ + "types/index.d.ts", + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-stringify-position#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "position", + "location", + "point", + "node", + "stringify", + "tostring" + ], + "license": "MIT", + "name": "unist-util-stringify-position", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-stringify-position.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilStringifyPosition > unist-util-stringify-position.js", + "build-mangle": "browserify . -s unistUtilStringifyPosition -p tinyify > unist-util-stringify-position.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "unist-util-stringify-position.js" + ] + } +} diff --git a/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/readme.md b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/readme.md new file mode 100644 index 00000000..bb565149 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/readme.md @@ -0,0 +1,140 @@ +# unist-util-stringify-position + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to pretty print the positional information of a node. + +## Install + +[npm][]: + +```sh +npm install unist-util-stringify-position +``` + +## Use + +```js +var stringify = require('unist-util-stringify-position') + +// Point +stringify({line: 2, column: 3}) // => '2:3' + +// Position +stringify({start: {line: 2}, end: {line: 3}}) // => '2:1-3:1' + +// Node +stringify({ + type: 'text', + value: '!', + position: { + start: {line: 5, column: 11}, + end: {line: 5, column: 12} + } +}) // => '5:11-5:12' +``` + +## API + +### `stringifyPosition(node|position|point)` + +Stringify one [point][], a [position][] (start and end [point][]s), or a node’s +[positional information][positional-information]. + +###### Parameters + +* `node` ([`Node`][node]) + — Node whose `'position'` property to stringify +* `position` ([`Position`][position]) + — Position whose `'start'` and `'end'` points to stringify +* `point` ([`Point`][point]) + — Point whose `'line'` and `'column'` to stringify + +###### Returns + +`string?` — A range `ls:cs-le:ce` (when given `node` or `position`) or a point +`l:c` (when given `point`), where `l` stands for line, `c` for column, `s` for +`start`, and `e` for end. +An empty string (`''`) is returned if the given value is neither `node`, +`position`, nor `point`. + +## Related + +* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) + — Check if a node is generated +* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) + — Get positional info of nodes +* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) + — Remove positional info from trees +* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) + — Get the source of a value (node or position) in a file + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-stringify-position.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-stringify-position + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-stringify-position.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-stringify-position + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-stringify-position.svg + +[downloads]: https://www.npmjs.com/package/unist-util-stringify-position + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-stringify-position.svg + +[size]: https://bundlephobia.com/result?p=unist-util-stringify-position + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[position]: https://github.com/syntax-tree/unist#position + +[point]: https://github.com/syntax-tree/unist#point + +[positional-information]: https://github.com/syntax-tree/unist#positional-information diff --git a/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/types/index.d.ts b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/types/index.d.ts new file mode 100644 index 00000000..8f31bc04 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-definitions/node_modules/unist-util-stringify-position/types/index.d.ts @@ -0,0 +1,9 @@ +// TypeScript Version: 3.0 + +import * as Unist from 'unist' + +declare function unistUtilStringifyPosition( + value: Unist.Node | Unist.Position | Unist.Point +): string + +export = unistUtilStringifyPosition diff --git a/node_modules/remark-lint-no-duplicate-definitions/package.json b/node_modules/remark-lint-no-duplicate-definitions/package.json new file mode 100644 index 00000000..8e01590d --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-definitions/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-no-duplicate-definitions@^1.0.0", + "_id": "remark-lint-no-duplicate-definitions@1.0.6", + "_inBundle": false, + "_integrity": "sha512-0biPtjVtGLRTN+ie7TzJpvKBau6sqkuQsQtuD07M0NSOmSvSU4vXUeOW73O5Q5xM3i6sYVESe+opaPefD3zEoA==", + "_location": "/remark-lint-no-duplicate-definitions", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-duplicate-definitions@^1.0.0", + "name": "remark-lint-no-duplicate-definitions", + "escapedName": "remark-lint-no-duplicate-definitions", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-1.0.6.tgz", + "_shasum": "07e5c24c7d29f442bf7d7492335d21456caf2c92", + "_spec": "remark-lint-no-duplicate-definitions@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-recommended", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-stringify-position": "^2.0.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn on duplicate definitions", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "duplicate", + "definition" + ], + "license": "MIT", + "name": "remark-lint-no-duplicate-definitions", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-duplicate-definitions" + }, + "version": "1.0.6", + "xo": false +} diff --git a/node_modules/remark-lint-no-duplicate-definitions/readme.md b/node_modules/remark-lint-no-duplicate-definitions/readme.md new file mode 100644 index 00000000..17b4e250 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-definitions/readme.md @@ -0,0 +1,150 @@ + + +# remark-lint-no-duplicate-definitions + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when duplicate definitions are found. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +[foo]: bar +[baz]: qux +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +[foo]: bar +[foo]: qux +``` + +###### Out + +```text +2:1-2:11: Do not use definitions with the same identifier (1:1) +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-duplicate-definitions +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-duplicate-definitions", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-duplicate-definitions readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-duplicate-definitions')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-duplicate-definitions.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-duplicate-definitions + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-duplicate-definitions.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-duplicate-definitions + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-duplicate-headings/index.js b/node_modules/remark-lint-no-duplicate-headings/index.js new file mode 100644 index 00000000..f1a41f62 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-headings/index.js @@ -0,0 +1,65 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-duplicate-headings + * @fileoverview + * Warn when duplicate headings are found. + * + * @example {"name": "ok.md"} + * + * # Foo + * + * ## Bar + * + * @example {"name": "not-ok.md", "label": "input"} + * + * # Foo + * + * ## Foo + * + * ## [Foo](http://foo.com/bar) + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:7: Do not use headings with similar content (1:1) + * 5:1-5:29: Do not use headings with similar content (3:1) + */ + +'use strict' + +var rule = require('unified-lint-rule') +var position = require('unist-util-position') +var generated = require('unist-util-generated') +var visit = require('unist-util-visit') +var stringify = require('unist-util-stringify-position') +var toString = require('mdast-util-to-string') + +module.exports = rule('remark-lint:no-duplicate-headings', noDuplicateHeadings) + +var reason = 'Do not use headings with similar content' + +function noDuplicateHeadings(tree, file) { + var map = {} + + visit(tree, 'heading', visitor) + + function visitor(node) { + var value + var duplicate + + if (!generated(node)) { + value = toString(node).toUpperCase() + duplicate = map[value] + + if (duplicate && duplicate.type === 'heading') { + file.message( + reason + ' (' + stringify(position.start(duplicate)) + ')', + node + ) + } + + map[value] = node + } + } +} diff --git a/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/index.js b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/index.js new file mode 100644 index 00000000..3d78a444 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/index.js @@ -0,0 +1,50 @@ +'use strict' + +var own = {}.hasOwnProperty + +module.exports = stringify + +function stringify(value) { + // Nothing. + if (!value || typeof value !== 'object') { + return '' + } + + // Node. + if (own.call(value, 'position') || own.call(value, 'type')) { + return position(value.position) + } + + // Position. + if (own.call(value, 'start') || own.call(value, 'end')) { + return position(value) + } + + // Point. + if (own.call(value, 'line') || own.call(value, 'column')) { + return point(value) + } + + // ? + return '' +} + +function point(point) { + if (!point || typeof point !== 'object') { + point = {} + } + + return index(point.line) + ':' + index(point.column) +} + +function position(pos) { + if (!pos || typeof pos !== 'object') { + pos = {} + } + + return point(pos.start) + '-' + point(pos.end) +} + +function index(value) { + return value && typeof value === 'number' ? value : 1 +} diff --git a/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/license b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/package.json b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/package.json new file mode 100644 index 00000000..3d8b2b04 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/package.json @@ -0,0 +1,123 @@ +{ + "_from": "unist-util-stringify-position@^2.0.0", + "_id": "unist-util-stringify-position@2.0.3", + "_inBundle": false, + "_integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", + "_location": "/remark-lint-no-duplicate-headings/unist-util-stringify-position", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-stringify-position@^2.0.0", + "name": "unist-util-stringify-position", + "escapedName": "unist-util-stringify-position", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-no-duplicate-headings" + ], + "_resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", + "_shasum": "cce3bfa1cdf85ba7375d1d5b17bdc4cada9bd9da", + "_spec": "unist-util-stringify-position@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-no-duplicate-headings", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-stringify-position/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.2" + }, + "deprecated": false, + "description": "unist utility to serialize a node, position, or point as a human readable location", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "xo": "^0.27.0" + }, + "files": [ + "types/index.d.ts", + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-stringify-position#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "position", + "location", + "point", + "node", + "stringify", + "tostring" + ], + "license": "MIT", + "name": "unist-util-stringify-position", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-stringify-position.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilStringifyPosition > unist-util-stringify-position.js", + "build-mangle": "browserify . -s unistUtilStringifyPosition -p tinyify > unist-util-stringify-position.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "unist-util-stringify-position.js" + ] + } +} diff --git a/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/readme.md b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/readme.md new file mode 100644 index 00000000..bb565149 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/readme.md @@ -0,0 +1,140 @@ +# unist-util-stringify-position + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to pretty print the positional information of a node. + +## Install + +[npm][]: + +```sh +npm install unist-util-stringify-position +``` + +## Use + +```js +var stringify = require('unist-util-stringify-position') + +// Point +stringify({line: 2, column: 3}) // => '2:3' + +// Position +stringify({start: {line: 2}, end: {line: 3}}) // => '2:1-3:1' + +// Node +stringify({ + type: 'text', + value: '!', + position: { + start: {line: 5, column: 11}, + end: {line: 5, column: 12} + } +}) // => '5:11-5:12' +``` + +## API + +### `stringifyPosition(node|position|point)` + +Stringify one [point][], a [position][] (start and end [point][]s), or a node’s +[positional information][positional-information]. + +###### Parameters + +* `node` ([`Node`][node]) + — Node whose `'position'` property to stringify +* `position` ([`Position`][position]) + — Position whose `'start'` and `'end'` points to stringify +* `point` ([`Point`][point]) + — Point whose `'line'` and `'column'` to stringify + +###### Returns + +`string?` — A range `ls:cs-le:ce` (when given `node` or `position`) or a point +`l:c` (when given `point`), where `l` stands for line, `c` for column, `s` for +`start`, and `e` for end. +An empty string (`''`) is returned if the given value is neither `node`, +`position`, nor `point`. + +## Related + +* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) + — Check if a node is generated +* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) + — Get positional info of nodes +* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) + — Remove positional info from trees +* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) + — Get the source of a value (node or position) in a file + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-stringify-position.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-stringify-position + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-stringify-position.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-stringify-position + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-stringify-position.svg + +[downloads]: https://www.npmjs.com/package/unist-util-stringify-position + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-stringify-position.svg + +[size]: https://bundlephobia.com/result?p=unist-util-stringify-position + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[position]: https://github.com/syntax-tree/unist#position + +[point]: https://github.com/syntax-tree/unist#point + +[positional-information]: https://github.com/syntax-tree/unist#positional-information diff --git a/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/types/index.d.ts b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/types/index.d.ts new file mode 100644 index 00000000..8f31bc04 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-headings/node_modules/unist-util-stringify-position/types/index.d.ts @@ -0,0 +1,9 @@ +// TypeScript Version: 3.0 + +import * as Unist from 'unist' + +declare function unistUtilStringifyPosition( + value: Unist.Node | Unist.Position | Unist.Point +): string + +export = unistUtilStringifyPosition diff --git a/node_modules/remark-lint-no-duplicate-headings/package.json b/node_modules/remark-lint-no-duplicate-headings/package.json new file mode 100644 index 00000000..0bb46884 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-headings/package.json @@ -0,0 +1,76 @@ +{ + "_from": "remark-lint-no-duplicate-headings@^1.0.0", + "_id": "remark-lint-no-duplicate-headings@1.0.5", + "_inBundle": false, + "_integrity": "sha512-4GKPxhKpN797V/6Jg1K4Zwqq+PhsjC633+wQMrZcTvOJfY+Rq1i7sNJ9lJVZnsDAlZJI56VqZCKnPJmS2br87g==", + "_location": "/remark-lint-no-duplicate-headings", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-duplicate-headings@^1.0.0", + "name": "remark-lint-no-duplicate-headings", + "escapedName": "remark-lint-no-duplicate-headings", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-headings/-/remark-lint-no-duplicate-headings-1.0.5.tgz", + "_shasum": "c65f65f254df4a6d5ccfff6f370141bbe142aa21", + "_spec": "remark-lint-no-duplicate-headings@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-stringify-position": "^2.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn on duplicate headings", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "duplicate", + "heading" + ], + "license": "MIT", + "name": "remark-lint-no-duplicate-headings", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-duplicate-headings" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-duplicate-headings/readme.md b/node_modules/remark-lint-no-duplicate-headings/readme.md new file mode 100644 index 00000000..801d3b48 --- /dev/null +++ b/node_modules/remark-lint-no-duplicate-headings/readme.md @@ -0,0 +1,155 @@ + + +# remark-lint-no-duplicate-headings + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when duplicate headings are found. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +# Foo + +## Bar +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +# Foo + +## Foo + +## [Foo](http://foo.com/bar) +``` + +###### Out + +```text +3:1-3:7: Do not use headings with similar content (1:1) +5:1-5:29: Do not use headings with similar content (3:1) +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-duplicate-headings +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-duplicate-headings", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-duplicate-headings readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-duplicate-headings')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-duplicate-headings.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-duplicate-headings + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-duplicate-headings.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-duplicate-headings + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-emphasis-as-heading/index.js b/node_modules/remark-lint-no-emphasis-as-heading/index.js new file mode 100644 index 00000000..97638c93 --- /dev/null +++ b/node_modules/remark-lint-no-emphasis-as-heading/index.js @@ -0,0 +1,61 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-emphasis-as-heading + * @fileoverview + * Warn when emphasis (including strong), instead of a heading, introduces + * a paragraph. + * + * @example {"name": "ok.md"} + * + * # Foo + * + * Bar. + * + * @example {"name": "not-ok.md", "label": "input"} + * + * *Foo* + * + * Bar. + * + * __Qux__ + * + * Quux. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:6: Don’t use emphasis to introduce a section, use a heading + * 5:1-5:8: Don’t use emphasis to introduce a section, use a heading + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:no-emphasis-as-heading', noEmphasisAsHeading) + +var reason = 'Don’t use emphasis to introduce a section, use a heading' + +function noEmphasisAsHeading(tree, file) { + visit(tree, 'paragraph', visitor) + + function visitor(node, index, parent) { + var head = node.children[0] + var previous = parent.children[index - 1] + var next = parent.children[index + 1] + + if ( + !generated(node) && + (!previous || previous.type !== 'heading') && + next && + next.type === 'paragraph' && + node.children.length === 1 && + (head.type === 'emphasis' || head.type === 'strong') + ) { + file.message(reason, node) + } + } +} diff --git a/node_modules/remark-lint-no-emphasis-as-heading/package.json b/node_modules/remark-lint-no-emphasis-as-heading/package.json new file mode 100644 index 00000000..e234d514 --- /dev/null +++ b/node_modules/remark-lint-no-emphasis-as-heading/package.json @@ -0,0 +1,71 @@ +{ + "_from": "remark-lint-no-emphasis-as-heading@^1.0.0", + "_id": "remark-lint-no-emphasis-as-heading@1.0.4", + "_inBundle": false, + "_integrity": "sha512-gnsInLxTkc59eVD3/qelFagD/NcrMPKXT1sy7i4e8D2jqQyrIHHl0p3TfiyNNt8qIjKMKhlIii4k4kVk/3Mczg==", + "_location": "/remark-lint-no-emphasis-as-heading", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-emphasis-as-heading@^1.0.0", + "name": "remark-lint-no-emphasis-as-heading", + "escapedName": "remark-lint-no-emphasis-as-heading", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-emphasis-as-heading/-/remark-lint-no-emphasis-as-heading-1.0.4.tgz", + "_shasum": "144aef1df77bfcdc7112bd0616a571a484e82538", + "_spec": "remark-lint-no-emphasis-as-heading@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when emphasis or importance is used instead of a heading", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "emphasis", + "heading" + ], + "license": "MIT", + "name": "remark-lint-no-emphasis-as-heading", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-emphasis-as-heading" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-emphasis-as-heading/readme.md b/node_modules/remark-lint-no-emphasis-as-heading/readme.md new file mode 100644 index 00000000..da524113 --- /dev/null +++ b/node_modules/remark-lint-no-emphasis-as-heading/readme.md @@ -0,0 +1,158 @@ + + +# remark-lint-no-emphasis-as-heading + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when emphasis (including strong), instead of a heading, introduces +a paragraph. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +# Foo + +Bar. +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +*Foo* + +Bar. + +__Qux__ + +Quux. +``` + +###### Out + +```text +1:1-1:6: Don’t use emphasis to introduce a section, use a heading +5:1-5:8: Don’t use emphasis to introduce a section, use a heading +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-emphasis-as-heading +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-emphasis-as-heading", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-emphasis-as-heading readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-emphasis-as-heading')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-emphasis-as-heading.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-emphasis-as-heading + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-emphasis-as-heading.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-emphasis-as-heading + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-file-name-articles/index.js b/node_modules/remark-lint-no-file-name-articles/index.js new file mode 100644 index 00000000..7efc1c4d --- /dev/null +++ b/node_modules/remark-lint-no-file-name-articles/index.js @@ -0,0 +1,40 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-articles + * @fileoverview + * Warn when file names start with an article. + * + * @example {"name": "title.md"} + * + * @example {"name": "a-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `a` + * + * @example {"name": "the-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `the` + * + * @example {"name": "teh-title.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `teh` + * + * @example {"name": "an-article.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not start file names with `an` + */ + +'use strict' + +var rule = require('unified-lint-rule') + +module.exports = rule('remark-lint:no-file-name-articles', noFileNameArticles) + +function noFileNameArticles(tree, file) { + var match = file.stem && file.stem.match(/^(the|teh|an?)\b/i) + + if (match) { + file.message('Do not start file names with `' + match[0] + '`') + } +} diff --git a/node_modules/remark-lint-no-file-name-articles/package.json b/node_modules/remark-lint-no-file-name-articles/package.json new file mode 100644 index 00000000..37551c9d --- /dev/null +++ b/node_modules/remark-lint-no-file-name-articles/package.json @@ -0,0 +1,71 @@ +{ + "_from": "remark-lint-no-file-name-articles@^1.0.0", + "_id": "remark-lint-no-file-name-articles@1.0.5", + "_inBundle": false, + "_integrity": "sha512-AQk5eTb3s3TAPPjiglZgqlQj4ycao+gPs8/XkdN1VCPUtewW0GgwoQe7YEuBKayJ6ioN8dGP37Kg/P/PlKaRQA==", + "_location": "/remark-lint-no-file-name-articles", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-file-name-articles@^1.0.0", + "name": "remark-lint-no-file-name-articles", + "escapedName": "remark-lint-no-file-name-articles", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-1.0.5.tgz", + "_shasum": "4ca3425f6613f94feaef6941028583299727c339", + "_spec": "remark-lint-no-file-name-articles@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when file name start with an article", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "file", + "name", + "basename", + "article" + ], + "license": "MIT", + "name": "remark-lint-no-file-name-articles", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-articles" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-file-name-articles/readme.md b/node_modules/remark-lint-no-file-name-articles/readme.md new file mode 100644 index 00000000..46f76a7a --- /dev/null +++ b/node_modules/remark-lint-no-file-name-articles/readme.md @@ -0,0 +1,160 @@ + + +# remark-lint-no-file-name-articles + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when file names start with an article. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `title.md` + +###### Out + +No messages. + +##### `a-title.md` + +###### Out + +```text +1:1: Do not start file names with `a` +``` + +##### `the-title.md` + +###### Out + +```text +1:1: Do not start file names with `the` +``` + +##### `teh-title.md` + +###### Out + +```text +1:1: Do not start file names with `teh` +``` + +##### `an-article.md` + +###### Out + +```text +1:1: Do not start file names with `an` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-file-name-articles +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-file-name-articles", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-file-name-articles readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-file-name-articles')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-file-name-articles.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-file-name-articles + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-file-name-articles.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-file-name-articles + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-file-name-consecutive-dashes/index.js b/node_modules/remark-lint-no-file-name-consecutive-dashes/index.js new file mode 100644 index 00000000..30f7038d --- /dev/null +++ b/node_modules/remark-lint-no-file-name-consecutive-dashes/index.js @@ -0,0 +1,31 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-consecutive-dashes + * @fileoverview + * Warn when file names contain consecutive dashes. + * + * @example {"name": "plug-ins.md"} + * + * @example {"name": "plug--ins.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use consecutive dashes in a file name + */ + +'use strict' + +var rule = require('unified-lint-rule') + +module.exports = rule( + 'remark-lint:no-file-name-consecutive-dashes', + noFileNameConsecutiveDashes +) + +var reason = 'Do not use consecutive dashes in a file name' + +function noFileNameConsecutiveDashes(tree, file) { + if (file.stem && /-{2,}/.test(file.stem)) { + file.message(reason) + } +} diff --git a/node_modules/remark-lint-no-file-name-consecutive-dashes/package.json b/node_modules/remark-lint-no-file-name-consecutive-dashes/package.json new file mode 100644 index 00000000..3dcdfeff --- /dev/null +++ b/node_modules/remark-lint-no-file-name-consecutive-dashes/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-no-file-name-consecutive-dashes@^1.0.0", + "_id": "remark-lint-no-file-name-consecutive-dashes@1.0.5", + "_inBundle": false, + "_integrity": "sha512-Mg2IDsi790/dSdAzwnBnsMYdZm3qC2QgGwqOWcr0TPABJhhjC3p8r5fX4MNMTXI5It7B7bW9+ImmCeLOZiXkLg==", + "_location": "/remark-lint-no-file-name-consecutive-dashes", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-file-name-consecutive-dashes@^1.0.0", + "name": "remark-lint-no-file-name-consecutive-dashes", + "escapedName": "remark-lint-no-file-name-consecutive-dashes", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-file-name-consecutive-dashes/-/remark-lint-no-file-name-consecutive-dashes-1.0.5.tgz", + "_shasum": "e9a6f2aeab948aa249c8a8356359e3d8843a4c5c", + "_spec": "remark-lint-no-file-name-consecutive-dashes@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when file names contain consecutive dashes", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "file", + "name", + "basename", + "dash", + "hyphen" + ], + "license": "MIT", + "name": "remark-lint-no-file-name-consecutive-dashes", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-consecutive-dashes" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-file-name-consecutive-dashes/readme.md b/node_modules/remark-lint-no-file-name-consecutive-dashes/readme.md new file mode 100644 index 00000000..f2a1b1ba --- /dev/null +++ b/node_modules/remark-lint-no-file-name-consecutive-dashes/readme.md @@ -0,0 +1,136 @@ + + +# remark-lint-no-file-name-consecutive-dashes + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when file names contain consecutive dashes. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `plug-ins.md` + +###### Out + +No messages. + +##### `plug--ins.md` + +###### Out + +```text +1:1: Do not use consecutive dashes in a file name +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-file-name-consecutive-dashes +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-file-name-consecutive-dashes", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-file-name-consecutive-dashes readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-file-name-consecutive-dashes')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-file-name-consecutive-dashes.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-file-name-consecutive-dashes + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-file-name-consecutive-dashes.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-file-name-consecutive-dashes + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-file-name-irregular-characters/index.js b/node_modules/remark-lint-no-file-name-irregular-characters/index.js new file mode 100644 index 00000000..6c768be0 --- /dev/null +++ b/node_modules/remark-lint-no-file-name-irregular-characters/index.js @@ -0,0 +1,59 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-irregular-characters + * @fileoverview + * Warn when file names contain irregular characters: characters other than + * alphanumericals (`a-zA-Z0-9`), hyphen-minus (`-`), and dots (`.`, full + * stops). + * + * Options: `RegExp` or `string`, default: `'\\.a-zA-Z0-9-'`. + * + * If a string is given, it will be wrapped in + * `new RegExp('[^' + preferred + ']')`. + * + * Any match by the wrapped or given expressions creates a message. + * + * @example {"name": "plug-ins.md"} + * + * @example {"name": "plugins.md"} + * + * @example {"name": "plug_ins.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use `_` in a file name + * + * @example {"name": "README.md", "label": "output", "setting": "\\.a-z0-9", "config": {"positionless": true}} + * + * 1:1: Do not use `R` in a file name + * + * @example {"name": "plug ins.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use ` ` in a file name + */ + +'use strict' + +var rule = require('unified-lint-rule') + +module.exports = rule( + 'remark-lint:no-file-name-irregular-characters', + noFileNameIrregularCharacters +) + +var expression = /[^\\.a-zA-Z\d-]/ + +function noFileNameIrregularCharacters(tree, file, option) { + var preferred = option || expression + var match + + if (typeof preferred === 'string') { + preferred = new RegExp('[^' + preferred + ']') + } + + match = file.stem && file.stem.match(preferred) + + if (match) { + file.message('Do not use `' + match[0] + '` in a file name') + } +} diff --git a/node_modules/remark-lint-no-file-name-irregular-characters/package.json b/node_modules/remark-lint-no-file-name-irregular-characters/package.json new file mode 100644 index 00000000..dbd95ad0 --- /dev/null +++ b/node_modules/remark-lint-no-file-name-irregular-characters/package.json @@ -0,0 +1,71 @@ +{ + "_from": "remark-lint-no-file-name-irregular-characters@^1.0.0", + "_id": "remark-lint-no-file-name-irregular-characters@1.0.5", + "_inBundle": false, + "_integrity": "sha512-Oe5i99qNUKc2bxmiH421o5B/kqlf1dfjAxpHNLhi2X2dXE91zRGavrlRM/4f4oR0N9Bqb3qB9JZPyMPWrzu9XA==", + "_location": "/remark-lint-no-file-name-irregular-characters", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-file-name-irregular-characters@^1.0.0", + "name": "remark-lint-no-file-name-irregular-characters", + "escapedName": "remark-lint-no-file-name-irregular-characters", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-file-name-irregular-characters/-/remark-lint-no-file-name-irregular-characters-1.0.5.tgz", + "_shasum": "6866f5b8370cdc916d55e7cf87bb6a55f9b6e0c6", + "_spec": "remark-lint-no-file-name-irregular-characters@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when file names contain irregular characters", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "file", + "name", + "irregular", + "character" + ], + "license": "MIT", + "name": "remark-lint-no-file-name-irregular-characters", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-irregular-characters" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-file-name-irregular-characters/readme.md b/node_modules/remark-lint-no-file-name-irregular-characters/readme.md new file mode 100644 index 00000000..e37ac4e6 --- /dev/null +++ b/node_modules/remark-lint-no-file-name-irregular-characters/readme.md @@ -0,0 +1,169 @@ + + +# remark-lint-no-file-name-irregular-characters + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when file names contain irregular characters: characters other than +alphanumericals (`a-zA-Z0-9`), hyphen-minus (`-`), and dots (`.`, full +stops). + +Options: `RegExp` or `string`, default: `'\\.a-zA-Z0-9-'`. + +If a string is given, it will be wrapped in +`new RegExp('[^' + preferred + ']')`. + +Any match by the wrapped or given expressions creates a message. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `plug-ins.md` + +###### Out + +No messages. + +##### `plugins.md` + +###### Out + +No messages. + +##### `plug_ins.md` + +###### Out + +```text +1:1: Do not use `_` in a file name +``` + +##### `plug ins.md` + +###### Out + +```text +1:1: Do not use ` ` in a file name +``` + +##### `README.md` + +When configured with `'\\.a-z0-9'`. + +###### Out + +```text +1:1: Do not use `R` in a file name +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-file-name-irregular-characters +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-file-name-irregular-characters", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-file-name-irregular-characters readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-file-name-irregular-characters')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-file-name-irregular-characters.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-file-name-irregular-characters + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-file-name-irregular-characters.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-file-name-irregular-characters + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-file-name-mixed-case/index.js b/node_modules/remark-lint-no-file-name-mixed-case/index.js new file mode 100644 index 00000000..5e29c75b --- /dev/null +++ b/node_modules/remark-lint-no-file-name-mixed-case/index.js @@ -0,0 +1,35 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-mixed-case + * @fileoverview + * Warn when file names use mixed case: both upper- and lowercase characters. + * + * @example {"name": "README.md"} + * + * @example {"name": "readme.md"} + * + * @example {"name": "Readme.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not mix casing in file names + */ + +'use strict' + +var rule = require('unified-lint-rule') + +module.exports = rule( + 'remark-lint:no-file-name-mixed-case', + noFileNameMixedCase +) + +var reason = 'Do not mix casing in file names' + +function noFileNameMixedCase(tree, file) { + var name = file.stem + + if (name && !(name === name.toLowerCase() || name === name.toUpperCase())) { + file.message(reason) + } +} diff --git a/node_modules/remark-lint-no-file-name-mixed-case/package.json b/node_modules/remark-lint-no-file-name-mixed-case/package.json new file mode 100644 index 00000000..6af3d1f1 --- /dev/null +++ b/node_modules/remark-lint-no-file-name-mixed-case/package.json @@ -0,0 +1,70 @@ +{ + "_from": "remark-lint-no-file-name-mixed-case@^1.0.0", + "_id": "remark-lint-no-file-name-mixed-case@1.0.5", + "_inBundle": false, + "_integrity": "sha512-ilrUCbHZin/ENwr8c3SC2chgkFsizXjBQIB/oZ7gnm1IkCkZPiMyXZAHdpwC/DjbrpGxfMYh9JmIHao4giS5+A==", + "_location": "/remark-lint-no-file-name-mixed-case", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-file-name-mixed-case@^1.0.0", + "name": "remark-lint-no-file-name-mixed-case", + "escapedName": "remark-lint-no-file-name-mixed-case", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-file-name-mixed-case/-/remark-lint-no-file-name-mixed-case-1.0.5.tgz", + "_shasum": "3e37bfef74bbdd4b07aa9ef9dd452758f8b46731", + "_spec": "remark-lint-no-file-name-mixed-case@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when file names use mixed case", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "file", + "name", + "case" + ], + "license": "MIT", + "name": "remark-lint-no-file-name-mixed-case", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-mixed-case" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-file-name-mixed-case/readme.md b/node_modules/remark-lint-no-file-name-mixed-case/readme.md new file mode 100644 index 00000000..b5e1e35a --- /dev/null +++ b/node_modules/remark-lint-no-file-name-mixed-case/readme.md @@ -0,0 +1,142 @@ + + +# remark-lint-no-file-name-mixed-case + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when file names use mixed case: both upper- and lowercase characters. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `README.md` + +###### Out + +No messages. + +##### `readme.md` + +###### Out + +No messages. + +##### `Readme.md` + +###### Out + +```text +1:1: Do not mix casing in file names +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-file-name-mixed-case +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-file-name-mixed-case", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-file-name-mixed-case readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-file-name-mixed-case')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-file-name-mixed-case.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-file-name-mixed-case + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-file-name-mixed-case.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-file-name-mixed-case + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-file-name-outer-dashes/index.js b/node_modules/remark-lint-no-file-name-outer-dashes/index.js new file mode 100644 index 00000000..53e8842f --- /dev/null +++ b/node_modules/remark-lint-no-file-name-outer-dashes/index.js @@ -0,0 +1,35 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-file-name-outer-dashes + * @fileoverview + * Warn when file names contain initial or final dashes (hyphen-minus, `-`). + * + * @example {"name": "readme.md"} + * + * @example {"name": "-readme.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use initial or final dashes in a file name + * + * @example {"name": "readme-.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Do not use initial or final dashes in a file name + */ + +'use strict' + +var rule = require('unified-lint-rule') + +module.exports = rule( + 'remark-lint:no-file-name-outer-dashes', + noFileNameOuterDashes +) + +var reason = 'Do not use initial or final dashes in a file name' + +function noFileNameOuterDashes(tree, file) { + if (file.stem && /^-|-$/.test(file.stem)) { + file.message(reason) + } +} diff --git a/node_modules/remark-lint-no-file-name-outer-dashes/package.json b/node_modules/remark-lint-no-file-name-outer-dashes/package.json new file mode 100644 index 00000000..af27157e --- /dev/null +++ b/node_modules/remark-lint-no-file-name-outer-dashes/package.json @@ -0,0 +1,71 @@ +{ + "_from": "remark-lint-no-file-name-outer-dashes@^1.0.0", + "_id": "remark-lint-no-file-name-outer-dashes@1.0.6", + "_inBundle": false, + "_integrity": "sha512-rT8CmcIlenegS0Yst4maYXdZfqIjBOiRUY8j/KJkORF5tKH+3O1/S07025qPGmcRihzK3w4yO0K8rgkKQw0b9w==", + "_location": "/remark-lint-no-file-name-outer-dashes", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-file-name-outer-dashes@^1.0.0", + "name": "remark-lint-no-file-name-outer-dashes", + "escapedName": "remark-lint-no-file-name-outer-dashes", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-file-name-outer-dashes/-/remark-lint-no-file-name-outer-dashes-1.0.6.tgz", + "_shasum": "4e0e4d42a63f0fdfb856bb5d8d8112725656e700", + "_spec": "remark-lint-no-file-name-outer-dashes@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when file names contain initial or final dashes", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "file", + "name", + "dash", + "hyphen" + ], + "license": "MIT", + "name": "remark-lint-no-file-name-outer-dashes", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-outer-dashes" + }, + "version": "1.0.6", + "xo": false +} diff --git a/node_modules/remark-lint-no-file-name-outer-dashes/readme.md b/node_modules/remark-lint-no-file-name-outer-dashes/readme.md new file mode 100644 index 00000000..eebf466e --- /dev/null +++ b/node_modules/remark-lint-no-file-name-outer-dashes/readme.md @@ -0,0 +1,144 @@ + + +# remark-lint-no-file-name-outer-dashes + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when file names contain initial or final dashes (hyphen-minus, `-`). + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `readme.md` + +###### Out + +No messages. + +##### `-readme.md` + +###### Out + +```text +1:1: Do not use initial or final dashes in a file name +``` + +##### `readme-.md` + +###### Out + +```text +1:1: Do not use initial or final dashes in a file name +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-file-name-outer-dashes +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-file-name-outer-dashes", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-file-name-outer-dashes readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-file-name-outer-dashes')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-file-name-outer-dashes.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-file-name-outer-dashes + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-file-name-outer-dashes.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-file-name-outer-dashes + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-heading-content-indent/index.js b/node_modules/remark-lint-no-heading-content-indent/index.js new file mode 100644 index 00000000..5379c7d3 --- /dev/null +++ b/node_modules/remark-lint-no-heading-content-indent/index.js @@ -0,0 +1,157 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-heading-content-indent + * @fileoverview + * Warn when content of headings is indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * removes all unneeded padding around content in headings. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * #·Foo + * + * ## Bar·## + * + * ##·Baz + * + * Setext headings are not affected. + * + * Baz + * === + * + * @example {"name": "not-ok.md", "label": "input"} + * + * #··Foo + * + * ## Bar··## + * + * ##··Baz + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:4: Remove 1 space before this heading’s content + * 3:7: Remove 1 space after this heading’s content + * 5:7: Remove 1 space before this heading’s content + * + * @example {"name": "empty-heading.md"} + * + * #·· + * + * @example {"name": "tight.md", "config":{"pedantic":true}, "label": "input"} + * + * In pedantic mode, headings without spacing can also be detected: + * + * ##No spacing left, too much right··## + * + * @example {"name": "tight.md", "label": "output"} + * + * 3:3: Add 1 space before this heading’s content + * 3:34: Remove 1 space after this heading’s content + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var style = require('mdast-util-heading-style') +var plural = require('plur') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:no-heading-content-indent', + noHeadingContentIndent +) + +var start = position.start +var end = position.end + +function noHeadingContentIndent(tree, file) { + var contents = String(file) + + visit(tree, 'heading', visitor) + + function visitor(node) { + var depth + var children + var type + var head + var initial + var final + var diff + var index + var char + var reason + + if (generated(node)) { + return + } + + depth = node.depth + children = node.children + type = style(node, 'atx') + + if (type === 'atx' || type === 'atx-closed') { + initial = start(node) + index = initial.offset + char = contents.charAt(index) + + while (char && char !== '#') { + char = contents.charAt(++index) + } + + /* istanbul ignore if - CR/LF bug: remarkjs/remark#195. */ + if (!char) { + return + } + + index = depth + (index - initial.offset) + head = start(children[0]).column + + // Ignore empty headings. + if (!head) { + return + } + + diff = head - initial.column - 1 - index + + if (diff) { + reason = + (diff > 0 ? 'Remove' : 'Add') + + ' ' + + Math.abs(diff) + + ' ' + + plural('space', diff) + + ' before this heading’s content' + + file.message(reason, start(children[0])) + } + } + + // Closed ATX headings always must have a space between their content and + // the final hashes, thus, there is no `add x spaces`. + if (type === 'atx-closed') { + final = end(children[children.length - 1]) + diff = end(node).column - final.column - 1 - depth + + if (diff) { + reason = + 'Remove ' + + diff + + ' ' + + plural('space', diff) + + ' after this heading’s content' + + file.message(reason, final) + } + } + } +} diff --git a/node_modules/remark-lint-no-heading-content-indent/package.json b/node_modules/remark-lint-no-heading-content-indent/package.json new file mode 100644 index 00000000..9f30edbe --- /dev/null +++ b/node_modules/remark-lint-no-heading-content-indent/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-no-heading-content-indent@^1.0.0", + "_id": "remark-lint-no-heading-content-indent@1.0.4", + "_inBundle": false, + "_integrity": "sha512-z+hcAsGbGiy28ERAZuOT1pYf6lkkoR2YlFUt4po4azfXMz5lmidYTotkezsWvA3Bh8N0mIi7hs8syPt8RRIGqg==", + "_location": "/remark-lint-no-heading-content-indent", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-heading-content-indent@^1.0.0", + "name": "remark-lint-no-heading-content-indent", + "escapedName": "remark-lint-no-heading-content-indent", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-heading-content-indent/-/remark-lint-no-heading-content-indent-1.0.4.tgz", + "_shasum": "85b01524f50c3e6c4fc7f728e691b5fb95bcb163", + "_spec": "remark-lint-no-heading-content-indent@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-recommended", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-heading-style": "^1.0.2", + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when heading content is indented", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "heading", + "content", + "indent" + ], + "license": "MIT", + "name": "remark-lint-no-heading-content-indent", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-heading-content-indent" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-heading-content-indent/readme.md b/node_modules/remark-lint-no-heading-content-indent/readme.md new file mode 100644 index 00000000..9d1047bf --- /dev/null +++ b/node_modules/remark-lint-no-heading-content-indent/readme.md @@ -0,0 +1,208 @@ + + +# remark-lint-no-heading-content-indent + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when content of headings is indented. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +removes all unneeded padding around content in headings. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +#·Foo + +## Bar·## + + ##·Baz + +Setext headings are not affected. + +Baz +=== +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +#··Foo + +## Bar··## + + ##··Baz +``` + +###### Out + +```text +1:4: Remove 1 space before this heading’s content +3:7: Remove 1 space after this heading’s content +5:7: Remove 1 space before this heading’s content +``` + +##### `empty-heading.md` + +###### In + +Note: `·` represents a space. + +```markdown +#·· +``` + +###### Out + +No messages. + +##### `tight.md` + +###### In + +Note: `·` represents a space. + +```markdown +In pedantic mode, headings without spacing can also be detected: + +##No spacing left, too much right··## +``` + +###### Out + +```text +3:3: Add 1 space before this heading’s content +3:34: Remove 1 space after this heading’s content +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-heading-content-indent +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-heading-content-indent", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-heading-content-indent readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-heading-content-indent')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-heading-content-indent.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-heading-content-indent + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-heading-content-indent.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-heading-content-indent + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-heading-punctuation/index.js b/node_modules/remark-lint-no-heading-punctuation/index.js new file mode 100644 index 00000000..7ee03fe8 --- /dev/null +++ b/node_modules/remark-lint-no-heading-punctuation/index.js @@ -0,0 +1,77 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-heading-punctuation + * @fileoverview + * Warn when a heading ends with a group of characters. + * + * Options: `string`, default: `'.,;:!?'`. + * + * Note: these are added to a regex, in a group (`'[' + char + ']'`), be + * careful to escape the string correctly. + * + * @example {"name": "ok.md"} + * + * # Hello + * + * @example {"name": "ok.md", "setting": ",;:!?"} + * + * # Hello… + * + * @example {"name": "not-ok.md", "label": "input"} + * + * # Hello: + * + * # Hello? + * + * # Hello! + * + * # Hello, + * + * # Hello; + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:9: Don’t add a trailing `:` to headings + * 3:1-3:9: Don’t add a trailing `?` to headings + * 5:1-5:9: Don’t add a trailing `!` to headings + * 7:1-7:9: Don’t add a trailing `,` to headings + * 9:1-9:9: Don’t add a trailing `;` to headings + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var generated = require('unist-util-generated') +var toString = require('mdast-util-to-string') + +module.exports = rule( + 'remark-lint:no-heading-punctuation', + noHeadingPunctuation +) + +var defaults = '\\.,;:!?' + +function noHeadingPunctuation(tree, file, option) { + var expression = new RegExp( + '[' + (typeof option === 'string' ? option : defaults) + ']' + ) + + visit(tree, 'heading', visitor) + + function visitor(node) { + var value + var tail + + if (!generated(node)) { + value = toString(node) + tail = value.charAt(value.length - 1) + + if (expression.test(tail)) { + file.message('Don’t add a trailing `' + tail + '` to headings', node) + } + } + } +} diff --git a/node_modules/remark-lint-no-heading-punctuation/package.json b/node_modules/remark-lint-no-heading-punctuation/package.json new file mode 100644 index 00000000..c8a00d8a --- /dev/null +++ b/node_modules/remark-lint-no-heading-punctuation/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-no-heading-punctuation@^1.0.0", + "_id": "remark-lint-no-heading-punctuation@1.0.4", + "_inBundle": false, + "_integrity": "sha512-++/HXg/qtVssJjzq2ZgEreoxaazw9KkYrAbTDImKV7Fypo+7bZFELUvFicq0/i9qwAwt1tvhkKtLYt1W/sr1JQ==", + "_location": "/remark-lint-no-heading-punctuation", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-heading-punctuation@^1.0.0", + "name": "remark-lint-no-heading-punctuation", + "escapedName": "remark-lint-no-heading-punctuation", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-heading-punctuation/-/remark-lint-no-heading-punctuation-1.0.4.tgz", + "_shasum": "f13adfd3a8b87646fb2e337120e22483a2a8b03e", + "_spec": "remark-lint-no-heading-punctuation@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when headings end in illegal characters", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "heading", + "character" + ], + "license": "MIT", + "name": "remark-lint-no-heading-punctuation", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-heading-punctuation" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-heading-punctuation/readme.md b/node_modules/remark-lint-no-heading-punctuation/readme.md new file mode 100644 index 00000000..b8a77c7f --- /dev/null +++ b/node_modules/remark-lint-no-heading-punctuation/readme.md @@ -0,0 +1,179 @@ + + +# remark-lint-no-heading-punctuation + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when a heading ends with a group of characters. + +Options: `string`, default: `'.,;:!?'`. + +Note: these are added to a regex, in a group (`'[' + char + ']'`), be +careful to escape the string correctly. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `':.'` | + +## Example + +##### `ok.md` + +###### In + +```markdown +# Hello +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +# Hello: + +# Hello? + +# Hello! + +# Hello, + +# Hello; +``` + +###### Out + +```text +1:1-1:9: Don’t add a trailing `:` to headings +3:1-3:9: Don’t add a trailing `?` to headings +5:1-5:9: Don’t add a trailing `!` to headings +7:1-7:9: Don’t add a trailing `,` to headings +9:1-9:9: Don’t add a trailing `;` to headings +``` + +##### `ok.md` + +When configured with `',;:!?'`. + +###### In + +```markdown +# Hello… +``` + +###### Out + +No messages. + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-heading-punctuation +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-heading-punctuation", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-heading-punctuation readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-heading-punctuation')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-heading-punctuation.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-heading-punctuation + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-heading-punctuation.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-heading-punctuation + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-inline-padding/index.js b/node_modules/remark-lint-no-inline-padding/index.js new file mode 100644 index 00000000..c29c29ef --- /dev/null +++ b/node_modules/remark-lint-no-inline-padding/index.js @@ -0,0 +1,53 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-inline-padding + * @fileoverview + * Warn when phrasing content is padded with spaces between their markers and + * content. + * + * Warns for emphasis, strong, delete, image, and link. + * + * @example {"name": "ok.md"} + * + * Alpha, *bravo*, _charlie_, [delta](http://echo.fox/trot) + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Alpha, * bravo *, _ charlie _, [ delta ](http://echo.fox/trot) + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:8-1:17: Don’t pad `emphasis` with inner spaces + * 1:19-1:30: Don’t pad `emphasis` with inner spaces + * 1:32-1:63: Don’t pad `link` with inner spaces + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var generated = require('unist-util-generated') +var toString = require('mdast-util-to-string') + +module.exports = rule('remark-lint:no-inline-padding', noInlinePadding) + +function noInlinePadding(tree, file) { + visit(tree, ['emphasis', 'strong', 'delete', 'image', 'link'], visitor) + + function visitor(node) { + var contents + + if (!generated(node)) { + contents = toString(node) + + if ( + contents.charAt(0) === ' ' || + contents.charAt(contents.length - 1) === ' ' + ) { + file.message('Don’t pad `' + node.type + '` with inner spaces', node) + } + } + } +} diff --git a/node_modules/remark-lint-no-inline-padding/package.json b/node_modules/remark-lint-no-inline-padding/package.json new file mode 100644 index 00000000..44e22fa6 --- /dev/null +++ b/node_modules/remark-lint-no-inline-padding/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-no-inline-padding@^1.0.0", + "_id": "remark-lint-no-inline-padding@1.0.5", + "_inBundle": false, + "_integrity": "sha512-AjS34hBRasYiIAKZJ7/9U42LouRHok2WVTRdQPcVtRBswStNOuot59S+FRsatqlk1wvMmjytqxUKQfVTSeu9ag==", + "_location": "/remark-lint-no-inline-padding", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-inline-padding@^1.0.0", + "name": "remark-lint-no-inline-padding", + "escapedName": "remark-lint-no-inline-padding", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-inline-padding/-/remark-lint-no-inline-padding-1.0.5.tgz", + "_shasum": "01ec68b2be9154601f68805ae5f5f3173c866ee0", + "_spec": "remark-lint-no-inline-padding@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when inline nodes are padded with spaces", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "inline", + "padding" + ], + "license": "MIT", + "name": "remark-lint-no-inline-padding", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-inline-padding" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-inline-padding/readme.md b/node_modules/remark-lint-no-inline-padding/readme.md new file mode 100644 index 00000000..5c70ae27 --- /dev/null +++ b/node_modules/remark-lint-no-inline-padding/readme.md @@ -0,0 +1,154 @@ + + +# remark-lint-no-inline-padding + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when phrasing content is padded with spaces between their markers and +content. + +Warns for emphasis, strong, delete, image, and link. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +Alpha, *bravo*, _charlie_, [delta](http://echo.fox/trot) +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +Alpha, * bravo *, _ charlie _, [ delta ](http://echo.fox/trot) +``` + +###### Out + +```text +1:8-1:17: Don’t pad `emphasis` with inner spaces +1:19-1:30: Don’t pad `emphasis` with inner spaces +1:32-1:63: Don’t pad `link` with inner spaces +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-inline-padding +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-inline-padding", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-inline-padding readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-inline-padding')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-inline-padding.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-inline-padding + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-inline-padding.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-inline-padding + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-literal-urls/index.js b/node_modules/remark-lint-no-literal-urls/index.js new file mode 100644 index 00000000..f42ae861 --- /dev/null +++ b/node_modules/remark-lint-no-literal-urls/index.js @@ -0,0 +1,65 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-literal-urls + * @fileoverview + * Warn for literal URLs in text. + * URLs are treated as links in some Markdown vendors, but not in others. + * To make sure they are always linked, wrap them in `<` (less than) and `>` + * (greater than). + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * never creates literal URLs and always uses `<` (less than) and `>` + * (greater than). + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * + * + * @example {"name": "not-ok.md", "label": "input"} + * + * http://foo.bar/baz + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:19: Don’t use literal URLs without angle brackets + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') +var toString = require('mdast-util-to-string') + +module.exports = rule('remark-lint:no-literal-urls', noLiteralURLs) + +var start = position.start +var end = position.end +var mailto = 'mailto:' +var reason = 'Don’t use literal URLs without angle brackets' + +function noLiteralURLs(tree, file) { + visit(tree, 'link', visitor) + + function visitor(node) { + var children = node.children + var value = toString(node) + + if ( + !generated(node) && + start(node).column === start(children[0]).column && + end(node).column === end(children[children.length - 1]).column && + (node.url === mailto + value || node.url === value) + ) { + file.message(reason, node) + } + } +} diff --git a/node_modules/remark-lint-no-literal-urls/package.json b/node_modules/remark-lint-no-literal-urls/package.json new file mode 100644 index 00000000..0b3c8745 --- /dev/null +++ b/node_modules/remark-lint-no-literal-urls/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-no-literal-urls@^1.0.0", + "_id": "remark-lint-no-literal-urls@1.0.4", + "_inBundle": false, + "_integrity": "sha512-sHjbzaSG4z6jMu1L0Qx1b7VvIQHy0bR4xZ6t9auJ5AoB5ua8hb/970s77irH1+46TF1ezhE7i+QDjmhcQi09xg==", + "_location": "/remark-lint-no-literal-urls", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-literal-urls@^1.0.0", + "name": "remark-lint-no-literal-urls", + "escapedName": "remark-lint-no-literal-urls", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-literal-urls/-/remark-lint-no-literal-urls-1.0.4.tgz", + "_shasum": "02152e46a6381a387f7f0bb887944a33e4b8aef4", + "_spec": "remark-lint-no-literal-urls@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-to-string": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when URLs without angle brackets are used", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "literal", + "url" + ], + "license": "MIT", + "name": "remark-lint-no-literal-urls", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-literal-urls" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-literal-urls/readme.md b/node_modules/remark-lint-no-literal-urls/readme.md new file mode 100644 index 00000000..2d5884e4 --- /dev/null +++ b/node_modules/remark-lint-no-literal-urls/readme.md @@ -0,0 +1,161 @@ + + +# remark-lint-no-literal-urls + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for literal URLs in text. +URLs are treated as links in some Markdown vendors, but not in others. +To make sure they are always linked, wrap them in `<` (less than) and `>` +(greater than). + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +never creates literal URLs and always uses `<` (less than) and `>` +(greater than). + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown + +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +http://foo.bar/baz +``` + +###### Out + +```text +1:1-1:19: Don’t use literal URLs without angle brackets +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-literal-urls +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-literal-urls", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-literal-urls readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-literal-urls')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-literal-urls.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-literal-urls + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-literal-urls.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-literal-urls + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-multiple-toplevel-headings/index.js b/node_modules/remark-lint-no-multiple-toplevel-headings/index.js new file mode 100644 index 00000000..b22f5121 --- /dev/null +++ b/node_modules/remark-lint-no-multiple-toplevel-headings/index.js @@ -0,0 +1,59 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-multiple-toplevel-headings + * @fileoverview + * Warn when multiple top level headings are used. + * + * Options: `number`, default: `1`. + * + * @example {"name": "ok.md", "setting": 1} + * + * # Foo + * + * ## Bar + * + * @example {"name": "not-ok.md", "setting": 1, "label": "input"} + * + * # Foo + * + * # Bar + * + * @example {"name": "not-ok.md", "setting": 1, "label": "output"} + * + * 3:1-3:6: Don’t use multiple top level headings (1:1) + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var start = require('unist-util-position').start +var generated = require('unist-util-generated') +var stringify = require('unist-util-stringify-position') + +module.exports = rule( + 'remark-lint:no-multiple-toplevel-headings', + noMultipleToplevelHeadings +) + +function noMultipleToplevelHeadings(tree, file, option) { + var preferred = option || 1 + var duplicate + + visit(tree, 'heading', visitor) + + function visitor(node) { + if (!generated(node) && node.depth === preferred) { + if (duplicate) { + file.message( + 'Don’t use multiple top level headings (' + duplicate + ')', + node + ) + } else { + duplicate = stringify(start(node)) + } + } + } +} diff --git a/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/index.js b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/index.js new file mode 100644 index 00000000..3d78a444 --- /dev/null +++ b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/index.js @@ -0,0 +1,50 @@ +'use strict' + +var own = {}.hasOwnProperty + +module.exports = stringify + +function stringify(value) { + // Nothing. + if (!value || typeof value !== 'object') { + return '' + } + + // Node. + if (own.call(value, 'position') || own.call(value, 'type')) { + return position(value.position) + } + + // Position. + if (own.call(value, 'start') || own.call(value, 'end')) { + return position(value) + } + + // Point. + if (own.call(value, 'line') || own.call(value, 'column')) { + return point(value) + } + + // ? + return '' +} + +function point(point) { + if (!point || typeof point !== 'object') { + point = {} + } + + return index(point.line) + ':' + index(point.column) +} + +function position(pos) { + if (!pos || typeof pos !== 'object') { + pos = {} + } + + return point(pos.start) + '-' + point(pos.end) +} + +function index(value) { + return value && typeof value === 'number' ? value : 1 +} diff --git a/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/license b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/package.json b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/package.json new file mode 100644 index 00000000..650c4eae --- /dev/null +++ b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/package.json @@ -0,0 +1,123 @@ +{ + "_from": "unist-util-stringify-position@^2.0.0", + "_id": "unist-util-stringify-position@2.0.3", + "_inBundle": false, + "_integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", + "_location": "/remark-lint-no-multiple-toplevel-headings/unist-util-stringify-position", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-stringify-position@^2.0.0", + "name": "unist-util-stringify-position", + "escapedName": "unist-util-stringify-position", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-no-multiple-toplevel-headings" + ], + "_resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", + "_shasum": "cce3bfa1cdf85ba7375d1d5b17bdc4cada9bd9da", + "_spec": "unist-util-stringify-position@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-no-multiple-toplevel-headings", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-stringify-position/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.2" + }, + "deprecated": false, + "description": "unist utility to serialize a node, position, or point as a human readable location", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "xo": "^0.27.0" + }, + "files": [ + "types/index.d.ts", + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-stringify-position#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "position", + "location", + "point", + "node", + "stringify", + "tostring" + ], + "license": "MIT", + "name": "unist-util-stringify-position", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-stringify-position.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilStringifyPosition > unist-util-stringify-position.js", + "build-mangle": "browserify . -s unistUtilStringifyPosition -p tinyify > unist-util-stringify-position.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "unist-util-stringify-position.js" + ] + } +} diff --git a/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/readme.md b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/readme.md new file mode 100644 index 00000000..bb565149 --- /dev/null +++ b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/readme.md @@ -0,0 +1,140 @@ +# unist-util-stringify-position + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to pretty print the positional information of a node. + +## Install + +[npm][]: + +```sh +npm install unist-util-stringify-position +``` + +## Use + +```js +var stringify = require('unist-util-stringify-position') + +// Point +stringify({line: 2, column: 3}) // => '2:3' + +// Position +stringify({start: {line: 2}, end: {line: 3}}) // => '2:1-3:1' + +// Node +stringify({ + type: 'text', + value: '!', + position: { + start: {line: 5, column: 11}, + end: {line: 5, column: 12} + } +}) // => '5:11-5:12' +``` + +## API + +### `stringifyPosition(node|position|point)` + +Stringify one [point][], a [position][] (start and end [point][]s), or a node’s +[positional information][positional-information]. + +###### Parameters + +* `node` ([`Node`][node]) + — Node whose `'position'` property to stringify +* `position` ([`Position`][position]) + — Position whose `'start'` and `'end'` points to stringify +* `point` ([`Point`][point]) + — Point whose `'line'` and `'column'` to stringify + +###### Returns + +`string?` — A range `ls:cs-le:ce` (when given `node` or `position`) or a point +`l:c` (when given `point`), where `l` stands for line, `c` for column, `s` for +`start`, and `e` for end. +An empty string (`''`) is returned if the given value is neither `node`, +`position`, nor `point`. + +## Related + +* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) + — Check if a node is generated +* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) + — Get positional info of nodes +* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) + — Remove positional info from trees +* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) + — Get the source of a value (node or position) in a file + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-stringify-position.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-stringify-position + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-stringify-position.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-stringify-position + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-stringify-position.svg + +[downloads]: https://www.npmjs.com/package/unist-util-stringify-position + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-stringify-position.svg + +[size]: https://bundlephobia.com/result?p=unist-util-stringify-position + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[position]: https://github.com/syntax-tree/unist#position + +[point]: https://github.com/syntax-tree/unist#point + +[positional-information]: https://github.com/syntax-tree/unist#positional-information diff --git a/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/types/index.d.ts b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/types/index.d.ts new file mode 100644 index 00000000..8f31bc04 --- /dev/null +++ b/node_modules/remark-lint-no-multiple-toplevel-headings/node_modules/unist-util-stringify-position/types/index.d.ts @@ -0,0 +1,9 @@ +// TypeScript Version: 3.0 + +import * as Unist from 'unist' + +declare function unistUtilStringifyPosition( + value: Unist.Node | Unist.Position | Unist.Point +): string + +export = unistUtilStringifyPosition diff --git a/node_modules/remark-lint-no-multiple-toplevel-headings/package.json b/node_modules/remark-lint-no-multiple-toplevel-headings/package.json new file mode 100644 index 00000000..62cf7177 --- /dev/null +++ b/node_modules/remark-lint-no-multiple-toplevel-headings/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-no-multiple-toplevel-headings@^1.0.0", + "_id": "remark-lint-no-multiple-toplevel-headings@1.0.5", + "_inBundle": false, + "_integrity": "sha512-RZ1YPxRO7Bo8mT+A36cZ7nx2QHFAKk+oE6j87YrZYpAKr2oF6snKS8nIGhVku4PSI/9cW1G12MZz1cAA5rcjFw==", + "_location": "/remark-lint-no-multiple-toplevel-headings", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-multiple-toplevel-headings@^1.0.0", + "name": "remark-lint-no-multiple-toplevel-headings", + "escapedName": "remark-lint-no-multiple-toplevel-headings", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-1.0.5.tgz", + "_shasum": "0ac0fa5adf2c87acb78ac44355b554d22f491002", + "_spec": "remark-lint-no-multiple-toplevel-headings@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-stringify-position": "^2.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when multiple top level headings are used", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "top-level", + "heading" + ], + "license": "MIT", + "name": "remark-lint-no-multiple-toplevel-headings", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-multiple-toplevel-headings" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-multiple-toplevel-headings/readme.md b/node_modules/remark-lint-no-multiple-toplevel-headings/readme.md new file mode 100644 index 00000000..1e632e9e --- /dev/null +++ b/node_modules/remark-lint-no-multiple-toplevel-headings/readme.md @@ -0,0 +1,158 @@ + + +# remark-lint-no-multiple-toplevel-headings + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when multiple top level headings are used. + +Options: `number`, default: `1`. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +When configured with `1`. + +###### In + +```markdown +# Foo + +## Bar +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `1`. + +###### In + +```markdown +# Foo + +# Bar +``` + +###### Out + +```text +3:1-3:6: Don’t use multiple top level headings (1:1) +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-multiple-toplevel-headings +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-multiple-toplevel-headings", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-multiple-toplevel-headings readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-multiple-toplevel-headings')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-multiple-toplevel-headings.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-multiple-toplevel-headings + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-multiple-toplevel-headings.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-multiple-toplevel-headings + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-shell-dollars/index.js b/node_modules/remark-lint-no-shell-dollars/index.js new file mode 100644 index 00000000..b2ca2e90 --- /dev/null +++ b/node_modules/remark-lint-no-shell-dollars/index.js @@ -0,0 +1,103 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-shell-dollars + * @fileoverview + * Warn when shell code is prefixed by `$` (dollar sign) characters. + * + * Ignores indented code blocks and fenced code blocks without language flag. + * + * @example {"name": "ok.md"} + * + * ```sh + * echo a + * echo a > file + * ``` + * + * ```zsh + * $ echo a + * a + * $ echo a > file + * ``` + * + * Some empty code: + * + * ```command + * ``` + * + * It’s fine to use dollars in non-shell code. + * + * ```js + * $('div').remove(); + * ``` + * + * @example {"name": "not-ok.md", "label": "input"} + * + * ```bash + * $ echo a + * $ echo a > file + * ``` + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-4:4: Do not use dollar signs before shell commands + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:no-shell-dollars', noShellDollars) + +var reason = 'Do not use dollar signs before shell commands' + +// List of shell script file extensions (also used as code flags for syntax +// highlighting on GitHub): +// See: +var flags = [ + 'sh', + 'bash', + 'bats', + 'cgi', + 'command', + 'fcgi', + 'ksh', + 'tmux', + 'tool', + 'zsh' +] + +function noShellDollars(tree, file) { + visit(tree, 'code', visitor) + + function visitor(node) { + var lines + var line + var length + var index + + // Check both known shell code and unknown code. + if (!generated(node) && node.lang && flags.indexOf(node.lang) !== -1) { + lines = node.value.split('\n') + length = lines.length + index = -1 + + if (length <= 1) { + return + } + + while (++index < length) { + line = lines[index] + + if (line.trim() && !line.match(/^\s*\$\s*/)) { + return + } + } + + file.message(reason, node) + } + } +} diff --git a/node_modules/remark-lint-no-shell-dollars/package.json b/node_modules/remark-lint-no-shell-dollars/package.json new file mode 100644 index 00000000..6230c9e0 --- /dev/null +++ b/node_modules/remark-lint-no-shell-dollars/package.json @@ -0,0 +1,71 @@ +{ + "_from": "remark-lint-no-shell-dollars@^1.0.0", + "_id": "remark-lint-no-shell-dollars@1.0.4", + "_inBundle": false, + "_integrity": "sha512-YXFj8FUVTKkVvoAbFY3zv1Ol7Kj1i+qdze3pXSgRG61y1LpfL8/HpnvFrseMbBmNw6o4WpjTo7GoArngJ1sCeg==", + "_location": "/remark-lint-no-shell-dollars", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-shell-dollars@^1.0.0", + "name": "remark-lint-no-shell-dollars", + "escapedName": "remark-lint-no-shell-dollars", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-1.0.4.tgz", + "_shasum": "18372714b94c0ee89e00ae02279bdc745b95afab", + "_spec": "remark-lint-no-shell-dollars@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when shell code is prefixed by dollars", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "dollar", + "shel" + ], + "license": "MIT", + "name": "remark-lint-no-shell-dollars", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shell-dollars" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-shell-dollars/readme.md b/node_modules/remark-lint-no-shell-dollars/readme.md new file mode 100644 index 00000000..793e2c9a --- /dev/null +++ b/node_modules/remark-lint-no-shell-dollars/readme.md @@ -0,0 +1,173 @@ + + +# remark-lint-no-shell-dollars + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when shell code is prefixed by `$` (dollar sign) characters. + +Ignores indented code blocks and fenced code blocks without language flag. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +````markdown +```sh +echo a +echo a > file +``` + +```zsh +$ echo a +a +$ echo a > file +``` + +Some empty code: + +```command +``` + +It’s fine to use dollars in non-shell code. + +```js +$('div').remove(); +``` +```` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +````markdown +```bash +$ echo a +$ echo a > file +``` +```` + +###### Out + +```text +1:1-4:4: Do not use dollar signs before shell commands +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-shell-dollars +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-shell-dollars", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-shell-dollars readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-shell-dollars')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-shell-dollars.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-shell-dollars + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-shell-dollars.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-shell-dollars + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-shortcut-reference-image/index.js b/node_modules/remark-lint-no-shortcut-reference-image/index.js new file mode 100644 index 00000000..e9e56f34 --- /dev/null +++ b/node_modules/remark-lint-no-shortcut-reference-image/index.js @@ -0,0 +1,53 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-shortcut-reference-image + * @fileoverview + * Warn when shortcut reference images are used. + * + * Shortcut references render as images when a definition is found, and as + * plain text without definition. + * Sometimes, you don’t intend to create an image from the reference, but this + * rule still warns anyway. + * In that case, you can escape the reference like so: `!\[foo]`. + * + * @example {"name": "ok.md"} + * + * ![foo][] + * + * [foo]: http://foo.bar/baz.png + * + * @example {"name": "not-ok.md", "label": "input"} + * + * ![foo] + * + * [foo]: http://foo.bar/baz.png + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:7: Use the trailing [] on reference images + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:no-shortcut-reference-image', + noShortcutReferenceImage +) + +var reason = 'Use the trailing [] on reference images' + +function noShortcutReferenceImage(tree, file) { + visit(tree, 'imageReference', visitor) + + function visitor(node) { + if (!generated(node) && node.referenceType === 'shortcut') { + file.message(reason, node) + } + } +} diff --git a/node_modules/remark-lint-no-shortcut-reference-image/package.json b/node_modules/remark-lint-no-shortcut-reference-image/package.json new file mode 100644 index 00000000..ab9af12b --- /dev/null +++ b/node_modules/remark-lint-no-shortcut-reference-image/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-no-shortcut-reference-image@^1.0.0", + "_id": "remark-lint-no-shortcut-reference-image@1.0.4", + "_inBundle": false, + "_integrity": "sha512-5/9QoesnOHIDwMHU9x+AGPBiFoMe9ZBKIR8nC17C6ZdksgwUIpjBJ3VX5POFlt5E6OhAZaeXqUCq9G2USccEdA==", + "_location": "/remark-lint-no-shortcut-reference-image", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-shortcut-reference-image@^1.0.0", + "name": "remark-lint-no-shortcut-reference-image", + "escapedName": "remark-lint-no-shortcut-reference-image", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-1.0.4.tgz", + "_shasum": "ed819f1af33738bb9003b3d92e043edcf7fd2d55", + "_spec": "remark-lint-no-shortcut-reference-image@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when shortcut reference images are used", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "shortcut", + "reference", + "image" + ], + "license": "MIT", + "name": "remark-lint-no-shortcut-reference-image", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shortcut-reference-image" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-no-shortcut-reference-image/readme.md b/node_modules/remark-lint-no-shortcut-reference-image/readme.md new file mode 100644 index 00000000..88b34865 --- /dev/null +++ b/node_modules/remark-lint-no-shortcut-reference-image/readme.md @@ -0,0 +1,159 @@ + + +# remark-lint-no-shortcut-reference-image + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when shortcut reference images are used. + +Shortcut references render as images when a definition is found, and as +plain text without definition. +Sometimes, you don’t intend to create an image from the reference, but this +rule still warns anyway. +In that case, you can escape the reference like so: `!\[foo]`. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +![foo][] + +[foo]: http://foo.bar/baz.png +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +![foo] + +[foo]: http://foo.bar/baz.png +``` + +###### Out + +```text +1:1-1:7: Use the trailing [] on reference images +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-shortcut-reference-image +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-shortcut-reference-image", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-shortcut-reference-image readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-shortcut-reference-image')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-shortcut-reference-image.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-shortcut-reference-image + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-shortcut-reference-image.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-shortcut-reference-image + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-shortcut-reference-link/index.js b/node_modules/remark-lint-no-shortcut-reference-link/index.js new file mode 100644 index 00000000..3b31604c --- /dev/null +++ b/node_modules/remark-lint-no-shortcut-reference-link/index.js @@ -0,0 +1,53 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-shortcut-reference-link + * @fileoverview + * Warn when shortcut reference links are used. + * + * Shortcut references render as links when a definition is found, and as + * plain text without definition. + * Sometimes, you don’t intend to create a link from the reference, but this + * rule still warns anyway. + * In that case, you can escape the reference like so: `\[foo]`. + * + * @example {"name": "ok.md"} + * + * [foo][] + * + * [foo]: http://foo.bar/baz + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [foo] + * + * [foo]: http://foo.bar/baz + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:6: Use the trailing `[]` on reference links + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:no-shortcut-reference-link', + noShortcutReferenceLink +) + +var reason = 'Use the trailing `[]` on reference links' + +function noShortcutReferenceLink(tree, file) { + visit(tree, 'linkReference', visitor) + + function visitor(node) { + if (!generated(node) && node.referenceType === 'shortcut') { + file.message(reason, node) + } + } +} diff --git a/node_modules/remark-lint-no-shortcut-reference-link/package.json b/node_modules/remark-lint-no-shortcut-reference-link/package.json new file mode 100644 index 00000000..f3f30a04 --- /dev/null +++ b/node_modules/remark-lint-no-shortcut-reference-link/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-no-shortcut-reference-link@^1.0.0", + "_id": "remark-lint-no-shortcut-reference-link@1.0.5", + "_inBundle": false, + "_integrity": "sha512-qDVL7/0ptOTd/nyd9u/4MYFWQtYQU8povdUB45UgTXy5Rrf1WsC+4DfzAEZkX3tOSTExdAIf1WOKqdC5xRcfvA==", + "_location": "/remark-lint-no-shortcut-reference-link", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-shortcut-reference-link@^1.0.0", + "name": "remark-lint-no-shortcut-reference-link", + "escapedName": "remark-lint-no-shortcut-reference-link", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-link/-/remark-lint-no-shortcut-reference-link-1.0.5.tgz", + "_shasum": "0c3c48a0ce80e85b89d3d2ec1d264b00eb151584", + "_spec": "remark-lint-no-shortcut-reference-link@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when shortcut reference links are used", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "shortcut", + "reference", + "link" + ], + "license": "MIT", + "name": "remark-lint-no-shortcut-reference-link", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shortcut-reference-link" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-shortcut-reference-link/readme.md b/node_modules/remark-lint-no-shortcut-reference-link/readme.md new file mode 100644 index 00000000..4fe09ab2 --- /dev/null +++ b/node_modules/remark-lint-no-shortcut-reference-link/readme.md @@ -0,0 +1,159 @@ + + +# remark-lint-no-shortcut-reference-link + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when shortcut reference links are used. + +Shortcut references render as links when a definition is found, and as +plain text without definition. +Sometimes, you don’t intend to create a link from the reference, but this +rule still warns anyway. +In that case, you can escape the reference like so: `\[foo]`. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +[foo][] + +[foo]: http://foo.bar/baz +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +[foo] + +[foo]: http://foo.bar/baz +``` + +###### Out + +```text +1:1-1:6: Use the trailing `[]` on reference links +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-shortcut-reference-link +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-shortcut-reference-link", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-shortcut-reference-link readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-shortcut-reference-link')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-shortcut-reference-link.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-shortcut-reference-link + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-shortcut-reference-link.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-shortcut-reference-link + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-table-indentation/index.js b/node_modules/remark-lint-no-table-indentation/index.js new file mode 100644 index 00000000..ba7cff42 --- /dev/null +++ b/node_modules/remark-lint-no-table-indentation/index.js @@ -0,0 +1,73 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module no-table-indentation + * @fileoverview + * Warn when tables are indented. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * removes all unneeded indentation before tables. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Paragraph. + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Paragraph. + * + * ···| A | B | + * ···| ----- | ----- | + * ···| Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:21: Do not indent table rows + * 5:1-5:21: Do not indent table rows + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:no-table-indentation', noTableIndentation) + +var reason = 'Do not indent table rows' + +function noTableIndentation(tree, file) { + var contents = String(file) + + visit(tree, 'table', visitor) + + function visitor(node) { + if (!generated(node)) { + node.children.forEach(each) + } + + return visit.SKIP + } + + function each(row) { + var fence = contents.slice( + position.start(row).offset, + position.start(row.children[0]).offset + ) + + if (fence.indexOf('|') > 1) { + file.message(reason, row) + } + } +} diff --git a/node_modules/remark-lint-no-table-indentation/package.json b/node_modules/remark-lint-no-table-indentation/package.json new file mode 100644 index 00000000..1b57e06a --- /dev/null +++ b/node_modules/remark-lint-no-table-indentation/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-no-table-indentation@^1.0.0", + "_id": "remark-lint-no-table-indentation@1.0.5", + "_inBundle": false, + "_integrity": "sha512-eE1GL+IzU3vtHdYCKHCZEIhCwiwCM7UH+pMDIMpGfH2LB3cB/Nrfbiz9xadGkARKqxxDMsJSBZDw4A/01IU+kA==", + "_location": "/remark-lint-no-table-indentation", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-table-indentation@^1.0.0", + "name": "remark-lint-no-table-indentation", + "escapedName": "remark-lint-no-table-indentation", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-1.0.5.tgz", + "_shasum": "e865ab34b172fa7f52ed410d5bb9a7b8adb18817", + "_spec": "remark-lint-no-table-indentation@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when tables are indented", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "table", + "indent" + ], + "license": "MIT", + "name": "remark-lint-no-table-indentation", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-table-indentation" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-no-table-indentation/readme.md b/node_modules/remark-lint-no-table-indentation/readme.md new file mode 100644 index 00000000..007a3a4a --- /dev/null +++ b/node_modules/remark-lint-no-table-indentation/readme.md @@ -0,0 +1,167 @@ + + +# remark-lint-no-table-indentation + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when tables are indented. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +removes all unneeded indentation before tables. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +Paragraph. + +| A | B | +| ----- | ----- | +| Alpha | Bravo | +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +Paragraph. + +···| A | B | +···| ----- | ----- | +···| Alpha | Bravo | +``` + +###### Out + +```text +3:1-3:21: Do not indent table rows +5:1-5:21: Do not indent table rows +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-table-indentation +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-table-indentation", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-table-indentation readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-table-indentation')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-table-indentation.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-table-indentation + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-table-indentation.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-table-indentation + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-undefined-references/index.js b/node_modules/remark-lint-no-undefined-references/index.js new file mode 100644 index 00000000..6a49094a --- /dev/null +++ b/node_modules/remark-lint-no-undefined-references/index.js @@ -0,0 +1,78 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module no-undefined-references + * @fileoverview + * Warn when references to undefined definitions are found. + * + * Options: `Object`, optional. + * + * The object can have an `allow` field, set to an array of strings that may + * appear between `[` and `]`, but that should not be treated as link + * identifiers. + * + * @example {"name": "ok.md"} + * + * [foo][] + * + * [foo]: https://example.com + * + * @example {"name": "ok-allow.md", "setting": {"allow": ["...", "…"]}} + * + * > Eliding a portion of a quoted passage […] is acceptable. + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [bar][] + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:8: Found reference to undefined definition + */ + +'use strict' + +var collapseWhiteSpace = require('collapse-white-space') +var rule = require('unified-lint-rule') +var generated = require('unist-util-generated') +var visit = require('unist-util-visit') + +module.exports = rule( + 'remark-lint:no-undefined-references', + noUndefinedReferences +) + +var reason = 'Found reference to undefined definition' + +// The identifier is upcased to avoid naming collisions with fields inherited +// from `Object.prototype`. +// If `Object.create(null)` was used in place of `{}`, downcasing would work +// equally well. +function normalize(s) { + return collapseWhiteSpace(s.toUpperCase()) +} + +function noUndefinedReferences(tree, file, option) { + var allow = ((option || {}).allow || []).map(normalize) + var map = {} + + visit(tree, ['definition', 'footnoteDefinition'], mark) + visit(tree, ['imageReference', 'linkReference', 'footnoteReference'], find) + + function mark(node) { + if (!generated(node)) { + map[normalize(node.identifier)] = true + } + } + + function find(node) { + if ( + !generated(node) && + !(normalize(node.identifier) in map) && + allow.indexOf(normalize(node.identifier)) === -1 + ) { + file.message(reason, node) + } + } +} diff --git a/node_modules/remark-lint-no-undefined-references/package.json b/node_modules/remark-lint-no-undefined-references/package.json new file mode 100644 index 00000000..89e69ce1 --- /dev/null +++ b/node_modules/remark-lint-no-undefined-references/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-no-undefined-references@^1.0.0", + "_id": "remark-lint-no-undefined-references@1.1.2", + "_inBundle": false, + "_integrity": "sha512-/MEXcusNFHx+BYUf4wuil+GVKTkofvT+VodjyGw5X0OuPZZJ9c/kL0QjHHzuLuGH+oJUsgOOfnJC/eyO0tV8bw==", + "_location": "/remark-lint-no-undefined-references", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-undefined-references@^1.0.0", + "name": "remark-lint-no-undefined-references", + "escapedName": "remark-lint-no-undefined-references", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-undefined-references/-/remark-lint-no-undefined-references-1.1.2.tgz", + "_shasum": "6bea9168ce88dd1d71d56f62afa1aad9ddbc17b8", + "_spec": "remark-lint-no-undefined-references@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-recommended", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "collapse-white-space": "^1.0.4", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when references to undefined definitions are found", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "reference", + "definition" + ], + "license": "MIT", + "name": "remark-lint-no-undefined-references", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-undefined-references" + }, + "version": "1.1.2", + "xo": false +} diff --git a/node_modules/remark-lint-no-undefined-references/readme.md b/node_modules/remark-lint-no-undefined-references/readme.md new file mode 100644 index 00000000..d3f3eb0a --- /dev/null +++ b/node_modules/remark-lint-no-undefined-references/readme.md @@ -0,0 +1,170 @@ + + +# remark-lint-no-undefined-references + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when references to undefined definitions are found. + +Options: `Object`, optional. + +The object can have an `allow` field, set to an array of strings that may +appear between `[` and `]`, but that should not be treated as link +identifiers. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +[foo][] + +[foo]: https://example.com +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +[bar][] +``` + +###### Out + +```text +1:1-1:8: Found reference to undefined definition +``` + +##### `ok-allow.md` + +When configured with `{ allow: [ '...', '…' ] }`. + +###### In + +```markdown +> Eliding a portion of a quoted passage […] is acceptable. +``` + +###### Out + +No messages. + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-undefined-references +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-undefined-references", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-undefined-references readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-undefined-references')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-undefined-references.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-undefined-references + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-undefined-references.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-undefined-references + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-no-unused-definitions/index.js b/node_modules/remark-lint-no-unused-definitions/index.js new file mode 100644 index 00000000..5614bb5c --- /dev/null +++ b/node_modules/remark-lint-no-unused-definitions/index.js @@ -0,0 +1,63 @@ +/** + * @author Titus Wormer + * @copyright 2016 Titus Wormer + * @license MIT + * @module no-unused-definitions + * @fileoverview + * Warn when unused definitions are found. + * + * @example {"name": "ok.md"} + * + * [foo][] + * + * [foo]: https://example.com + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [bar]: https://example.com + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1-1:27: Found unused definition + */ + +'use strict' + +var rule = require('unified-lint-rule') +var generated = require('unist-util-generated') +var visit = require('unist-util-visit') + +module.exports = rule('remark-lint:no-unused-definitions', noUnusedDefinitions) + +var reason = 'Found unused definition' + +function noUnusedDefinitions(tree, file) { + var map = {} + var identifier + var entry + + visit(tree, ['definition', 'footnoteDefinition'], find) + visit(tree, ['imageReference', 'linkReference', 'footnoteReference'], mark) + + for (identifier in map) { + entry = map[identifier] + + if (!entry.used) { + file.message(reason, entry.node) + } + } + + function find(node) { + if (!generated(node)) { + map[node.identifier.toUpperCase()] = {node: node, used: false} + } + } + + function mark(node) { + var info = map[node.identifier.toUpperCase()] + + if (!generated(node) && info) { + info.used = true + } + } +} diff --git a/node_modules/remark-lint-no-unused-definitions/package.json b/node_modules/remark-lint-no-unused-definitions/package.json new file mode 100644 index 00000000..4cf8230e --- /dev/null +++ b/node_modules/remark-lint-no-unused-definitions/package.json @@ -0,0 +1,70 @@ +{ + "_from": "remark-lint-no-unused-definitions@^1.0.0", + "_id": "remark-lint-no-unused-definitions@1.0.6", + "_inBundle": false, + "_integrity": "sha512-hYHMjbg3wBGT30R9PN74Bieejg2qRkXH9Rc2YakP1unuJoF+X+i5RMsW71spW11/r/+gW2mdzuwBuBoQrWpGTA==", + "_location": "/remark-lint-no-unused-definitions", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-no-unused-definitions@^1.0.0", + "name": "remark-lint-no-unused-definitions", + "escapedName": "remark-lint-no-unused-definitions", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-1.0.6.tgz", + "_shasum": "ee48af96fe6c44961328d7fda3e301d24e37c14f", + "_spec": "remark-lint-no-unused-definitions@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-recommended", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when unused definitions are found", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "definition" + ], + "license": "MIT", + "name": "remark-lint-no-unused-definitions", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-unused-definitions" + }, + "version": "1.0.6", + "xo": false +} diff --git a/node_modules/remark-lint-no-unused-definitions/readme.md b/node_modules/remark-lint-no-unused-definitions/readme.md new file mode 100644 index 00000000..75ddd52b --- /dev/null +++ b/node_modules/remark-lint-no-unused-definitions/readme.md @@ -0,0 +1,150 @@ + + +# remark-lint-no-unused-definitions + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when unused definitions are found. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +[foo][] + +[foo]: https://example.com +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +[bar]: https://example.com +``` + +###### Out + +```text +1:1-1:27: Found unused definition +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-no-unused-definitions +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-no-unused-definitions", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-no-unused-definitions readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-no-unused-definitions')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-no-unused-definitions.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-no-unused-definitions + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-no-unused-definitions.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-no-unused-definitions + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-ordered-list-marker-style/index.js b/node_modules/remark-lint-ordered-list-marker-style/index.js new file mode 100644 index 00000000..726052ce --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/index.js @@ -0,0 +1,117 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module ordered-list-marker-style + * @fileoverview + * Warn when the list item marker style of ordered lists violate a given style. + * + * Options: `'consistent'`, `'.'`, or `')'`, default: `'consistent'`. + * + * `'consistent'` detects the first used list style and warns when subsequent + * lists use different styles. + * + * Note: `)` is only supported in CommonMark. + * + * @example {"name": "ok.md"} + * + * 1. Foo + * + * + * 1. Bar + * + * Unordered lists are not affected by this rule. + * + * * Foo + * + * @example {"name": "ok.md", "setting": "."} + * + * 1. Foo + * + * 2. Bar + * + * @example {"name": "ok.md", "setting": ")", "config": {"commonmark": true}} + * + * + * + * 1) Foo + * + * 2) Bar + * + * @example {"name": "not-ok.md", "label": "input", "config": {"commonmark": true}} + * + * 1. Foo + * + * 2) Bar + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:8: Marker style should be `.` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:ordered-list-marker-style', + orderedListMarkerStyle +) + +var start = position.start + +var styles = { + ')': true, + '.': true, + null: true +} + +function orderedListMarkerStyle(tree, file, option) { + var contents = String(file) + var preferred = + typeof option !== 'string' || option === 'consistent' ? null : option + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect ordered list item marker style `' + + preferred + + "`: use either `'.'` or `')'`" + ) + } + + visit(tree, 'list', visitor) + + function visitor(node) { + var children = node.children + var length = node.ordered ? children.length : 0 + var index = -1 + var marker + var child + + while (++index < length) { + child = children[index] + + if (!generated(child)) { + marker = contents + .slice(start(child).offset, start(child.children[0]).offset) + .replace(/\s|\d/g, '') + .replace(/\[[x ]?]\s*$/i, '') + + if (preferred) { + if (marker !== preferred) { + file.message('Marker style should be `' + preferred + '`', child) + } + } else { + preferred = marker + } + } + } + } +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/index.js b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/license b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/package.json b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..ae0c3ad1 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-ordered-list-marker-style/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-ordered-list-marker-style/unist-util-visit", + "/remark-lint-ordered-list-marker-style/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..f39d49ad --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-ordered-list-marker-style/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-ordered-list-marker-style/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/license b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..77fe222c --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-ordered-list-marker-style/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-ordered-list-marker-style" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-ordered-list-marker-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-ordered-list-marker-style/package.json b/node_modules/remark-lint-ordered-list-marker-style/package.json new file mode 100644 index 00000000..fbca85c0 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-ordered-list-marker-style@^2.0.0", + "_id": "remark-lint-ordered-list-marker-style@2.0.1", + "_inBundle": false, + "_integrity": "sha512-Cnpw1Dn9CHn+wBjlyf4qhPciiJroFOEGmyfX008sQ8uGoPZsoBVIJx76usnHklojSONbpjEDcJCjnOvfAcWW1A==", + "_location": "/remark-lint-ordered-list-marker-style", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-ordered-list-marker-style@^2.0.0", + "name": "remark-lint-ordered-list-marker-style", + "escapedName": "remark-lint-ordered-list-marker-style", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-2.0.1.tgz", + "_shasum": "183c31967e6f2ae8ef00effad03633f7fd00ffaa", + "_spec": "remark-lint-ordered-list-marker-style@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when the markers of ordered lists violate a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "ordered", + "list", + "marker" + ], + "license": "MIT", + "name": "remark-lint-ordered-list-marker-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-ordered-list-marker-style" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-ordered-list-marker-style/readme.md b/node_modules/remark-lint-ordered-list-marker-style/readme.md new file mode 100644 index 00000000..820d91b5 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-style/readme.md @@ -0,0 +1,210 @@ + + +# remark-lint-ordered-list-marker-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the list item marker style of ordered lists violate a given style. + +Options: `'consistent'`, `'.'`, or `')'`, default: `'consistent'`. + +`'consistent'` detects the first used list style and warns when subsequent +lists use different styles. + +Note: `)` is only supported in CommonMark. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'.'` | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended) | `'.'` | + +## Example + +##### `ok.md` + +###### In + +```markdown +1. Foo + + +1. Bar + +Unordered lists are not affected by this rule. + +* Foo +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +1. Foo + +2) Bar +``` + +###### Out + +```text +3:1-3:8: Marker style should be `.` +``` + +##### `ok.md` + +When configured with `'.'`. + +###### In + +```markdown +1. Foo + +2. Bar +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `')'`. + +###### In + +```markdown + + +1) Foo + +2) Bar +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-ordered-list-marker-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-ordered-list-marker-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-ordered-list-marker-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-ordered-list-marker-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-ordered-list-marker-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-ordered-list-marker-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-ordered-list-marker-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-ordered-list-marker-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-ordered-list-marker-value/index.js b/node_modules/remark-lint-ordered-list-marker-value/index.js new file mode 100644 index 00000000..20add83d --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-value/index.js @@ -0,0 +1,195 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module ordered-list-marker-value + * @fileoverview + * Warn when the list item marker values of ordered lists violate a given + * style. + * + * Options: `'single'`, `'one'`, or `'ordered'`, default: `'ordered'`. + * + * When set to `'ordered'`, list item bullets should increment by one, + * relative to the starting point. + * When set to `'single'`, bullets should be the same as the relative starting + * point. + * When set to `'one'`, bullets should always be `1`. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * retains the number of the first list item bullet, and by default + * increments the other items. + * Pass + * [`incrementListMarker: false`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsincrementlistmarker) + * to not increment further list items. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * The default value is `ordered`, so unless changed, the below + * is OK. + * + * 1. Foo + * 2. Bar + * 3. Baz + * + * Paragraph. + * + * 3. Alpha + * 4. Bravo + * 5. Charlie + * + * Unordered lists are not affected by this rule. + * + * * Anton + * + * @example {"name": "ok.md", "setting": "one"} + * + * 1. Foo + * 1. Bar + * 1. Baz + * + * Paragraph. + * + * 1. Alpha + * 1. Bravo + * 1. Charlie + * + * @example {"name": "ok.md", "setting": "single"} + * + * 1. Foo + * 1. Bar + * 1. Baz + * + * Paragraph. + * + * 3. Alpha + * 3. Bravo + * 3. Charlie + * + * Paragraph. + * + * 0. Delta + * 0. Echo + * 0. Foxtrot + * + * @example {"name": "ok.md", "setting": "ordered"} + * + * 1. Foo + * 2. Bar + * 3. Baz + * + * Paragraph. + * + * 3. Alpha + * 4. Bravo + * 5. Charlie + * + * Paragraph. + * + * 0. Delta + * 1. Echo + * 2. Foxtrot + * + * @example {"name": "not-ok.md", "setting": "one", "label": "input"} + * + * 1. Foo + * 2. Bar + * + * @example {"name": "not-ok.md", "setting": "one", "label": "output"} + * + * 2:1-2:8: Marker should be `1`, was `2` + * + * @example {"name": "also-not-ok.md", "setting": "one", "label": "input"} + * + * 2. Foo + * 1. Bar + * + * @example {"name": "also-not-ok.md", "setting": "one", "label": "output"} + * + * 1:1-1:8: Marker should be `1`, was `2` + * + * @example {"name": "not-ok.md", "setting": "ordered", "label": "input"} + * + * 1. Foo + * 1. Bar + * + * @example {"name": "not-ok.md", "setting": "ordered", "label": "output"} + * + * 2:1-2:8: Marker should be `2`, was `1` + * + * @example {"name": "not-ok.md", "setting": "💩", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect ordered list item marker value `💩`: use either `'ordered'` or `'one'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:ordered-list-marker-value', + orderedListMarkerValue +) + +var start = position.start + +var styles = {ordered: true, single: true, one: true} + +function orderedListMarkerValue(tree, file, option) { + var contents = String(file) + var preferred = typeof option === 'string' ? option : 'ordered' + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect ordered list item marker value `' + + preferred + + "`: use either `'ordered'` or `'one'`" + ) + } + + visit(tree, 'list', visitor) + + function visitor(node) { + var children = node.children + var expected = preferred === 'one' ? 1 : node.start == null ? 1 : node.start + var length = node.ordered ? children.length : 0 + var index = -1 + var child + var marker + + while (++index < length) { + child = children[index] + + // Ignore generated nodes, first items. + if (generated(child) || (index === 0 && preferred !== 'one')) { + continue + } + + // Increase the expected line number when in `ordered` mode. + if (preferred === 'ordered') { + expected++ + } + + marker = Number( + contents + .slice(start(child).offset, start(child.children[0]).offset) + .replace(/[\s.)]/g, '') + .replace(/\[[x ]?]\s*$/i, '') + ) + + if (marker !== expected) { + file.message( + 'Marker should be `' + expected + '`, was `' + marker + '`', + child + ) + } + } + } +} diff --git a/node_modules/remark-lint-ordered-list-marker-value/package.json b/node_modules/remark-lint-ordered-list-marker-value/package.json new file mode 100644 index 00000000..821720b6 --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-value/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-ordered-list-marker-value@^1.0.0", + "_id": "remark-lint-ordered-list-marker-value@1.0.5", + "_inBundle": false, + "_integrity": "sha512-eKepbNNfu9rEuG8WvV0sc7B+KiPMgq5Nc9baAxL9Hi6mhpj347YFWXxJUNttSINS13YTpnHxPvXmF9SzhjFKNQ==", + "_location": "/remark-lint-ordered-list-marker-value", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-ordered-list-marker-value@^1.0.0", + "name": "remark-lint-ordered-list-marker-value", + "escapedName": "remark-lint-ordered-list-marker-value", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-value/-/remark-lint-ordered-list-marker-value-1.0.5.tgz", + "_shasum": "00b52a49aa77e8ed81c53354843846d30525c35b", + "_spec": "remark-lint-ordered-list-marker-value@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when the marker value of ordered lists violates a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "ordered", + "list", + "marker" + ], + "license": "MIT", + "name": "remark-lint-ordered-list-marker-value", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-value" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-lint-ordered-list-marker-value/readme.md b/node_modules/remark-lint-ordered-list-marker-value/readme.md new file mode 100644 index 00000000..01a220dd --- /dev/null +++ b/node_modules/remark-lint-ordered-list-marker-value/readme.md @@ -0,0 +1,309 @@ + + +# remark-lint-ordered-list-marker-value + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the list item marker values of ordered lists violate a given +style. + +Options: `'single'`, `'one'`, or `'ordered'`, default: `'ordered'`. + +When set to `'ordered'`, list item bullets should increment by one, +relative to the starting point. +When set to `'single'`, bullets should be the same as the relative starting +point. +When set to `'one'`, bullets should always be `1`. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +retains the number of the first list item bullet, and by default +increments the other items. +Pass +[`incrementListMarker: false`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsincrementlistmarker) +to not increment further list items. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'one'` | + +## Example + +##### `ok.md` + +###### In + +```markdown +The default value is `ordered`, so unless changed, the below +is OK. + +1. Foo +2. Bar +3. Baz + +Paragraph. + +3. Alpha +4. Bravo +5. Charlie + +Unordered lists are not affected by this rule. + +* Anton +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'one'`. + +###### In + +```markdown +1. Foo +1. Bar +1. Baz + +Paragraph. + +1. Alpha +1. Bravo +1. Charlie +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'one'`. + +###### In + +```markdown +1. Foo +2. Bar +``` + +###### Out + +```text +2:1-2:8: Marker should be `1`, was `2` +``` + +##### `also-not-ok.md` + +When configured with `'one'`. + +###### In + +```markdown +2. Foo +1. Bar +``` + +###### Out + +```text +1:1-1:8: Marker should be `1`, was `2` +``` + +##### `ok.md` + +When configured with `'single'`. + +###### In + +```markdown +1. Foo +1. Bar +1. Baz + +Paragraph. + +3. Alpha +3. Bravo +3. Charlie + +Paragraph. + +0. Delta +0. Echo +0. Foxtrot +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'ordered'`. + +###### In + +```markdown +1. Foo +2. Bar +3. Baz + +Paragraph. + +3. Alpha +4. Bravo +5. Charlie + +Paragraph. + +0. Delta +1. Echo +2. Foxtrot +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'ordered'`. + +###### In + +```markdown +1. Foo +1. Bar +``` + +###### Out + +```text +2:1-2:8: Marker should be `2`, was `1` +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect ordered list item marker value `💩`: use either `'ordered'` or `'one'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-ordered-list-marker-value +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-ordered-list-marker-value", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-ordered-list-marker-value readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-ordered-list-marker-value')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-ordered-list-marker-value.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-ordered-list-marker-value + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-ordered-list-marker-value.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-ordered-list-marker-value + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-rule-style/index.js b/node_modules/remark-lint-rule-style/index.js new file mode 100644 index 00000000..3a3f26ee --- /dev/null +++ b/node_modules/remark-lint-rule-style/index.js @@ -0,0 +1,100 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module rule-style + * @fileoverview + * Warn when the thematic breaks (horizontal rules) violate a given or + * detected style. + * + * Options: `string`, either a corect thematic breaks such as `***`, or + * `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used thematic break style and warns when + * subsequent rules use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * has three settings that define how rules are created: + * + * * [`rule`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrule) + * (default: `*`) — Marker to use + * * [`ruleRepetition`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrulerepetition) + * (default: `3`) — Number of markers to use + * * [`ruleSpaces`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrulespaces) + * (default: `true`) — Whether to pad markers with spaces + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "* * *"} + * + * * * * + * + * * * * + * + * @example {"name": "ok.md", "setting": "_______"} + * + * _______ + * + * _______ + * + * @example {"name": "not-ok.md", "label": "input"} + * + * *** + * + * * * * + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:6: Rules should use `***` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:rule-style', ruleStyle) + +var start = position.start +var end = position.end + +function ruleStyle(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (preferred !== null && /[^-_* ]/.test(preferred)) { + file.fail( + "Incorrect preferred rule style: provide a correct markdown rule or `'consistent'`" + ) + } + + visit(tree, 'thematicBreak', visitor) + + function visitor(node) { + var initial = start(node).offset + var final = end(node).offset + var rule + + if (!generated(node)) { + rule = contents.slice(initial, final) + + if (preferred) { + if (rule !== preferred) { + file.message('Rules should use `' + preferred + '`', node) + } + } else { + preferred = rule + } + } + } +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-is/index.js b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-is/license b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-rule-style/node_modules/unist-util-is/package.json b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..8dbf5a1b --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-rule-style/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-rule-style/unist-util-visit", + "/remark-lint-rule-style/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-rule-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-rule-style/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..6f303af2 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-rule-style/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-rule-style/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-rule-style/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/license b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-rule-style/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..ddad8781 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-rule-style/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-rule-style" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-rule-style", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-rule-style/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-rule-style/package.json b/node_modules/remark-lint-rule-style/package.json new file mode 100644 index 00000000..469ca098 --- /dev/null +++ b/node_modules/remark-lint-rule-style/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-rule-style@^2.0.0", + "_id": "remark-lint-rule-style@2.0.1", + "_inBundle": false, + "_integrity": "sha512-hz4Ff9UdlYmtO6Czz99WJavCjqCer7Cav4VopXt+yVIikObw96G5bAuLYcVS7hvMUGqC9ZuM02/Y/iq9n8pkAg==", + "_location": "/remark-lint-rule-style", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-rule-style@^2.0.0", + "name": "remark-lint-rule-style", + "escapedName": "remark-lint-rule-style", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-2.0.1.tgz", + "_shasum": "f59bd82e75d3eaabd0eee1c8c0f5513372eb553c", + "_spec": "remark-lint-rule-style@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when horizontal rules violate a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "horizontal", + "thematic", + "break" + ], + "license": "MIT", + "name": "remark-lint-rule-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-rule-style" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-rule-style/readme.md b/node_modules/remark-lint-rule-style/readme.md new file mode 100644 index 00000000..83db5b7b --- /dev/null +++ b/node_modules/remark-lint-rule-style/readme.md @@ -0,0 +1,203 @@ + + +# remark-lint-rule-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the thematic breaks (horizontal rules) violate a given or +detected style. + +Options: `string`, either a corect thematic breaks such as `***`, or +`'consistent'`, default: `'consistent'`. + +`'consistent'` detects the first used thematic break style and warns when +subsequent rules use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +has three settings that define how rules are created: + +* [`rule`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrule) + (default: `*`) — Marker to use +* [`ruleRepetition`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrulerepetition) + (default: `3`) — Number of markers to use +* [`ruleSpaces`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsrulespaces) + (default: `true`) — Whether to pad markers with spaces + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'---'` | + +## Example + +##### `ok.md` + +When configured with `'* * *'`. + +###### In + +```markdown +* * * + +* * * +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'_______'`. + +###### In + +```markdown +_______ + +_______ +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +*** + +* * * +``` + +###### Out + +```text +3:1-3:6: Rules should use `***` +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-rule-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-rule-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-rule-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-rule-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-rule-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-rule-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-rule-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-rule-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-strong-marker/index.js b/node_modules/remark-lint-strong-marker/index.js new file mode 100644 index 00000000..d9400f1a --- /dev/null +++ b/node_modules/remark-lint-strong-marker/index.js @@ -0,0 +1,96 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module strong-marker + * @fileoverview + * Warn for violating importance (strong) markers. + * + * Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + * + * `'consistent'` detects the first used importance style and warns when + * subsequent importance sequences use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats importance using an `*` (asterisk) by default. + * Pass + * [`strong: '_'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsstrong) + * to use `_` (underscore) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * **foo** and **bar**. + * + * @example {"name": "also-ok.md"} + * + * __foo__ and __bar__. + * + * @example {"name": "ok.md", "setting": "*"} + * + * **foo**. + * + * @example {"name": "ok.md", "setting": "_"} + * + * __foo__. + * + * @example {"name": "not-ok.md", "label": "input"} + * + * **foo** and __bar__. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:13-1:20: Strong should use `*` as a marker + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:strong-marker', strongMarker) + +var markers = {'*': true, _: true, null: true} + +function strongMarker(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (markers[preferred] !== true) { + file.fail( + 'Incorrect strong marker `' + + preferred + + "`: use either `'consistent'`, `'*'`, or `'_'`" + ) + } + + visit(tree, 'strong', visitor) + + function visitor(node) { + var marker = contents.charAt(position.start(node).offset) + + if (!generated(node)) { + if (preferred) { + if (marker !== preferred) { + file.message( + 'Strong should use `' + preferred + '` as a marker', + node + ) + } + } else { + preferred = marker + } + } + } +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/index.js b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/license b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-strong-marker/node_modules/unist-util-is/package.json b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..584b8472 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-strong-marker/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-strong-marker/unist-util-visit", + "/remark-lint-strong-marker/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-strong-marker/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..313732a3 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-strong-marker/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-strong-marker/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/license b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-strong-marker/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..58c52650 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-strong-marker/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-strong-marker" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-strong-marker", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-strong-marker/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-strong-marker/package.json b/node_modules/remark-lint-strong-marker/package.json new file mode 100644 index 00000000..b182570a --- /dev/null +++ b/node_modules/remark-lint-strong-marker/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-strong-marker@^2.0.0", + "_id": "remark-lint-strong-marker@2.0.1", + "_inBundle": false, + "_integrity": "sha512-8X2IsW1jZ5FmW9PLfQjkL0OVy/J3xdXLcZrG1GTeQKQ91BrPFyEZqUM2oM6Y4S6LGtxWer+neZkPZNroZoRPBQ==", + "_location": "/remark-lint-strong-marker", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-strong-marker@^2.0.0", + "name": "remark-lint-strong-marker", + "escapedName": "remark-lint-strong-marker", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-2.0.1.tgz", + "_shasum": "1ad8f190c6ac0f8138b638965ccf3bcd18f6d4e4", + "_spec": "remark-lint-strong-marker@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when importance (strong) markers violate the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "strong", + "marker", + "importance" + ], + "license": "MIT", + "name": "remark-lint-strong-marker", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-strong-marker" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-strong-marker/readme.md b/node_modules/remark-lint-strong-marker/readme.md new file mode 100644 index 00000000..0af3057d --- /dev/null +++ b/node_modules/remark-lint-strong-marker/readme.md @@ -0,0 +1,215 @@ + + +# remark-lint-strong-marker + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for violating importance (strong) markers. + +Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + +`'consistent'` detects the first used importance style and warns when +subsequent importance sequences use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats importance using an `*` (asterisk) by default. +Pass +[`strong: '_'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsstrong) +to use `_` (underscore) instead. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'*'` | + +## Example + +##### `ok.md` + +###### In + +```markdown +**foo** and **bar**. +``` + +###### Out + +No messages. + +##### `also-ok.md` + +###### In + +```markdown +__foo__ and __bar__. +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +**foo** and __bar__. +``` + +###### Out + +```text +1:13-1:20: Strong should use `*` as a marker +``` + +##### `ok.md` + +When configured with `'*'`. + +###### In + +```markdown +**foo**. +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'_'`. + +###### In + +```markdown +__foo__. +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-strong-marker +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-strong-marker", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-strong-marker readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-strong-marker')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-strong-marker.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-strong-marker + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-strong-marker.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-strong-marker + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-table-cell-padding/index.js b/node_modules/remark-lint-table-cell-padding/index.js new file mode 100644 index 00000000..d5460a76 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/index.js @@ -0,0 +1,295 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module table-cell-padding + * @fileoverview + * Warn when table cells are incorrectly padded. + * + * Options: `'consistent'`, `'padded'`, or `'compact'`, default: `'consistent'`. + * + * `'consistent'` detects the first used cell padding style and warns when + * subsequent cells use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats tables with padding by default. + * Pass + * [`spacedTable: false`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsspacedtable) + * to not use padding. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "padded"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input", "setting": "padded"} + * + * | A | B | + * | :----|----: | + * | Alpha|Bravo | + * + * | C | D | + * | :----- | ---: | + * |Charlie | Delta| + * + * Too much padding isn’t good either: + * + * | E | F | G | H | + * | :---- | -------- | :----: | -----: | + * | Echo | Foxtrot | Golf | Hotel | + * + * @example {"name": "not-ok.md", "label": "output", "setting": "padded"} + * + * 3:8: Cell should be padded + * 3:9: Cell should be padded + * 7:2: Cell should be padded + * 7:17: Cell should be padded + * 13:23: Cell should be padded with 1 space, not 2 + * 13:32: Cell should be padded with 1 space, not 2 + * + * @example {"name": "ok.md", "setting": "compact"} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * @example {"name": "not-ok.md", "label": "input", "setting": "compact"} + * + * | A | B | + * | -----| -----| + * | Alpha| Bravo| + * + * |C | D| + * |:------|-----:| + * |Charlie|Delta | + * + * @example {"name": "not-ok.md", "label": "output", "setting": "compact"} + * + * 3:5: Cell should be compact + * 3:12: Cell should be compact + * 7:15: Cell should be compact + * + * @example {"name": "ok-padded.md", "setting": "consistent"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * | C | D | + * | ------- | ----- | + * | Charlie | Delta | + * + * @example {"name": "not-ok-padded.md", "label": "input", "setting": "consistent"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * | C | D | + * | :----- | ----: | + * |Charlie | Delta | + * + * @example {"name": "not-ok-padded.md", "label": "output", "setting": "consistent"} + * + * 7:2: Cell should be padded + * + * @example {"name": "ok-compact.md", "setting": "consistent"} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * |C |D | + * |-------|-----| + * |Charlie|Delta| + * + * @example {"name": "not-ok-compact.md", "label": "input", "setting": "consistent"} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * |C | D| + * |:------|-----:| + * |Charlie|Delta | + * + * @example {"name": "not-ok-compact.md", "label": "output", "setting": "consistent"} + * + * 7:15: Cell should be compact + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'` + * + * @example {"name": "empty.md", "label": "input", "setting": "padded"} + * + * + * + * | | Alpha | Bravo| + * | ------ | ----- | ---: | + * | Charlie| | Echo| + * + * @example {"name": "empty.md", "label": "output", "setting": "padded"} + * + * 3:25: Cell should be padded + * 5:10: Cell should be padded + * 5:25: Cell should be padded + * + * @example {"name": "missing-body.md", "setting": "padded"} + * + * + * + * | Alpha | Bravo | Charlie | + * | ----- | ------- | ------- | + * | Delta | + * | Echo | Foxtrot | + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:table-cell-padding', tableCellPadding) + +var start = position.start +var end = position.end + +var styles = {null: true, padded: true, compact: true} + +function tableCellPadding(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect table cell padding style `' + + preferred + + "`, expected `'padded'`, `'compact'`, or `'consistent'`" + ) + } + + visit(tree, 'table', visitor) + + function visitor(node) { + var rows = node.children + var sizes = new Array(node.align.length) + var length = generated(node) ? -1 : rows.length + var index = -1 + var entries = [] + var style + var row + var cells + var column + var cellCount + var cell + var next + var fence + var pos + var entry + var final + + // Check rows. + while (++index < length) { + row = rows[index] + cells = row.children + cellCount = cells.length + column = -2 // Start without a first cell. + next = null + final = undefined + + // Check fences (before, between, and after cells). + while (++column < cellCount) { + cell = next + next = cells[column + 1] + + fence = contents.slice( + cell ? end(cell).offset : start(row).offset, + next ? start(next).offset : end(row).offset + ) + + pos = fence.indexOf('|') + + if (cell && cell.children.length !== 0 && final !== undefined) { + entries.push({node: cell, start: final, end: pos, index: column}) + + // Detect max space per column. + sizes[column] = Math.max(sizes[column] || 0, size(cell)) + } else { + final = undefined + } + + if (next && next.children.length !== 0) { + final = fence.length - pos - 1 + } else { + final = undefined + } + } + } + + if (preferred) { + style = preferred === 'padded' ? 1 : 0 + } else { + style = entries[0] && (!entries[0].start || !entries[0].end) ? 0 : 1 + } + + index = -1 + length = entries.length + + while (++index < length) { + entry = entries[index] + checkSide('start', entry, style, sizes) + checkSide('end', entry, style, sizes) + } + + return visit.SKIP + } + + function checkSide(side, entry, style, sizes) { + var cell = entry.node + var spacing = entry[side] + var index = entry.index + var reason + + if (spacing === undefined || spacing === style) { + return + } + + reason = 'Cell should be ' + + if (style === 0) { + reason += 'compact' + + // Ignore every cell except the biggest in the column. + if (size(cell) < sizes[index]) { + return + } + } else { + reason += 'padded' + + if (spacing > style) { + reason += ' with 1 space, not ' + spacing + + // May be right or center aligned. + if (size(cell) < sizes[index]) { + return + } + } + } + + file.message(reason, cell.position[side]) + } +} + +function size(node) { + return end(node).offset - start(node).offset +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/convert.js b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/index.d.ts b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/index.js b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/license b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-table-cell-padding/node_modules/unist-util-is/package.json b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..99aaf1e8 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-lint-table-cell-padding/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint-table-cell-padding/unist-util-visit", + "/remark-lint-table-cell-padding/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/readme.md b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/license b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..da79ab61 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-lint-table-cell-padding/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-lint-table-cell-padding/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/index.js b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/license b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-lint-table-cell-padding/node_modules/unist-util-visit/package.json b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..f70739f6 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-lint-table-cell-padding/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-lint-table-cell-padding" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-table-cell-padding", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/readme.md b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-lint-table-cell-padding/package.json b/node_modules/remark-lint-table-cell-padding/package.json new file mode 100644 index 00000000..cc1e32c6 --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-table-cell-padding@^2.0.0", + "_id": "remark-lint-table-cell-padding@2.0.1", + "_inBundle": false, + "_integrity": "sha512-vytUq4O1cg9UBXyeduANqpVqlbZpEtpXe/hYdvAObWgp1Jr7l74Zcvm+pn/ouaCuAsrxDVWeTa5Mg3V4OByw4g==", + "_location": "/remark-lint-table-cell-padding", + "_phantomChildren": { + "@types/unist": "2.0.3" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-table-cell-padding@^2.0.0", + "name": "remark-lint-table-cell-padding", + "escapedName": "remark-lint-table-cell-padding", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-2.0.1.tgz", + "_shasum": "b1e557ec44e1a33beb45578e97bf9441149379f6", + "_spec": "remark-lint-table-cell-padding@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when table cells are incorrectly padded", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "table", + "cell", + "padding" + ], + "license": "MIT", + "name": "remark-lint-table-cell-padding", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-table-cell-padding" + }, + "version": "2.0.1", + "xo": false +} diff --git a/node_modules/remark-lint-table-cell-padding/readme.md b/node_modules/remark-lint-table-cell-padding/readme.md new file mode 100644 index 00000000..fddbbb1d --- /dev/null +++ b/node_modules/remark-lint-table-cell-padding/readme.md @@ -0,0 +1,363 @@ + + +# remark-lint-table-cell-padding + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when table cells are incorrectly padded. + +Options: `'consistent'`, `'padded'`, or `'compact'`, default: `'consistent'`. + +`'consistent'` detects the first used cell padding style and warns when +subsequent cells use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats tables with padding by default. +Pass +[`spacedTable: false`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsspacedtable) +to not use padding. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'padded'` | + +## Example + +##### `ok.md` + +When configured with `'padded'`. + +###### In + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'padded'`. + +###### In + +```markdown +| A | B | +| :----|----: | +| Alpha|Bravo | + +| C | D | +| :----- | ---: | +|Charlie | Delta| + +Too much padding isn’t good either: + +| E | F | G | H | +| :---- | -------- | :----: | -----: | +| Echo | Foxtrot | Golf | Hotel | +``` + +###### Out + +```text +3:8: Cell should be padded +3:9: Cell should be padded +7:2: Cell should be padded +7:17: Cell should be padded +13:23: Cell should be padded with 1 space, not 2 +13:32: Cell should be padded with 1 space, not 2 +``` + +##### `empty.md` + +When configured with `'padded'`. + +###### In + +```markdown + + +| | Alpha | Bravo| +| ------ | ----- | ---: | +| Charlie| | Echo| +``` + +###### Out + +```text +3:25: Cell should be padded +5:10: Cell should be padded +5:25: Cell should be padded +``` + +##### `missing-body.md` + +When configured with `'padded'`. + +###### In + +```markdown + + +| Alpha | Bravo | Charlie | +| ----- | ------- | ------- | +| Delta | +| Echo | Foxtrot | +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'compact'`. + +###### In + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'compact'`. + +###### In + +```markdown +| A | B | +| -----| -----| +| Alpha| Bravo| + +|C | D| +|:------|-----:| +|Charlie|Delta | +``` + +###### Out + +```text +3:5: Cell should be compact +3:12: Cell should be compact +7:15: Cell should be compact +``` + +##### `ok-padded.md` + +When configured with `'consistent'`. + +###### In + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | + +| C | D | +| ------- | ----- | +| Charlie | Delta | +``` + +###### Out + +No messages. + +##### `not-ok-padded.md` + +When configured with `'consistent'`. + +###### In + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | + +| C | D | +| :----- | ----: | +|Charlie | Delta | +``` + +###### Out + +```text +7:2: Cell should be padded +``` + +##### `ok-compact.md` + +When configured with `'consistent'`. + +###### In + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| + +|C |D | +|-------|-----| +|Charlie|Delta| +``` + +###### Out + +No messages. + +##### `not-ok-compact.md` + +When configured with `'consistent'`. + +###### In + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| + +|C | D| +|:------|-----:| +|Charlie|Delta | +``` + +###### Out + +```text +7:15: Cell should be compact +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-table-cell-padding +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-table-cell-padding", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-table-cell-padding readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-table-cell-padding')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-table-cell-padding.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-table-cell-padding + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-table-cell-padding.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-table-cell-padding + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-table-pipe-alignment/index.js b/node_modules/remark-lint-table-pipe-alignment/index.js new file mode 100644 index 00000000..0f0c7741 --- /dev/null +++ b/node_modules/remark-lint-table-pipe-alignment/index.js @@ -0,0 +1,112 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module table-pipe-alignment + * @fileoverview + * Warn when table pipes are not aligned. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * tries to align tables by default. + * Pass + * [`paddedTable: false`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionspaddedtable) + * to not align cells. + * + * Aligning cells perfectly is impossible as some characters (such as emoji or + * Chinese characters) are rendered differently in different browsers, + * terminals, and editors. + * You can pass your own + * [`stringLength`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsstringlength) + * function to customize how cells are aligned. + * In that case, this rule must be turned off. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input"} + * + * | A | B | + * | -- | -- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:9-3:10: Misaligned table fence + * 3:17-3:18: Misaligned table fence + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:table-pipe-alignment', tablePipeAlignment) + +var start = position.start +var end = position.end + +var reason = 'Misaligned table fence' + +function tablePipeAlignment(tree, file) { + var contents = String(file) + + visit(tree, 'table', visitor) + + function visitor(node) { + var rows = node.children + var length = generated(node) ? 0 : rows.length + var index = -1 + var indices = [] + var row + var cells + var begin + var column + var columns + var cell + var initial + var final + var next + var nextIndex + var fence + var pos + + while (++index < length) { + row = rows[index] + begin = start(row) + cells = row.children + columns = cells.length + column = -2 // Start without a first cell. + next = null + + while (++column < columns) { + cell = next + nextIndex = column + 1 + next = cells[nextIndex] + + initial = cell ? end(cell).offset : start(row).offset + final = next ? start(next).offset : end(row).offset + fence = contents.slice(initial, final) + pos = initial + fence.indexOf('|') - begin.offset + 1 + + if (indices[nextIndex] === undefined || indices[nextIndex] === null) { + indices[nextIndex] = pos + } else if (pos !== indices[nextIndex]) { + file.message(reason, { + start: {line: begin.line, column: pos}, + end: {line: begin.line, column: pos + 1} + }) + } + } + } + } +} diff --git a/node_modules/remark-lint-table-pipe-alignment/package.json b/node_modules/remark-lint-table-pipe-alignment/package.json new file mode 100644 index 00000000..be04421a --- /dev/null +++ b/node_modules/remark-lint-table-pipe-alignment/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-table-pipe-alignment@^1.0.0", + "_id": "remark-lint-table-pipe-alignment@1.0.4", + "_inBundle": false, + "_integrity": "sha512-pmELEOXeUjMQedyVvOtZcTCnTu6FxZ4gfBskMx6iJhOFEEKTFOmviqlKLpndPBxFNZB86AiE0C00/NvAaut8dw==", + "_location": "/remark-lint-table-pipe-alignment", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-table-pipe-alignment@^1.0.0", + "name": "remark-lint-table-pipe-alignment", + "escapedName": "remark-lint-table-pipe-alignment", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-table-pipe-alignment/-/remark-lint-table-pipe-alignment-1.0.4.tgz", + "_shasum": "5b6a08bc7a8eb66f5002667991405b616d0ffb02", + "_spec": "remark-lint-table-pipe-alignment@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when table pipes are not aligned", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "table", + "cell", + "pipe", + "align" + ], + "license": "MIT", + "name": "remark-lint-table-pipe-alignment", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-table-pipe-alignment" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-table-pipe-alignment/readme.md b/node_modules/remark-lint-table-pipe-alignment/readme.md new file mode 100644 index 00000000..7bf6fb16 --- /dev/null +++ b/node_modules/remark-lint-table-pipe-alignment/readme.md @@ -0,0 +1,172 @@ + + +# remark-lint-table-pipe-alignment + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when table pipes are not aligned. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +tries to align tables by default. +Pass +[`paddedTable: false`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionspaddedtable) +to not align cells. + +Aligning cells perfectly is impossible as some characters (such as emoji or +Chinese characters) are rendered differently in different browsers, +terminals, and editors. +You can pass your own +[`stringLength`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsstringlength) +function to customize how cells are aligned. +In that case, this rule must be turned off. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +| A | B | +| -- | -- | +| Alpha | Bravo | +``` + +###### Out + +```text +3:9-3:10: Misaligned table fence +3:17-3:18: Misaligned table fence +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-table-pipe-alignment +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-table-pipe-alignment", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-table-pipe-alignment readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-table-pipe-alignment')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-table-pipe-alignment.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-table-pipe-alignment + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-table-pipe-alignment.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-table-pipe-alignment + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-table-pipes/index.js b/node_modules/remark-lint-table-pipes/index.js new file mode 100644 index 00000000..6b44b802 --- /dev/null +++ b/node_modules/remark-lint-table-pipes/index.js @@ -0,0 +1,91 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module table-pipes + * @fileoverview + * Warn when table rows are not fenced with pipes. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * creates fenced rows with initial and final pipes by default. + * Pass + * [`looseTable: true`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsloosetable) + * to not use row fences. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input"} + * + * A | B + * ----- | ----- + * Alpha | Bravo + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:1: Missing initial pipe in table fence + * 1:10: Missing final pipe in table fence + * 3:1: Missing initial pipe in table fence + * 3:14: Missing final pipe in table fence + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:table-pipes', tablePipes) + +var start = position.start +var end = position.end + +var reasonStart = 'Missing initial pipe in table fence' +var reasonEnd = 'Missing final pipe in table fence' + +function tablePipes(tree, file) { + var contents = String(file) + + visit(tree, 'table', visitor) + + function visitor(node) { + var rows = node.children + var length = rows.length + var index = -1 + var row + var cells + var head + var tail + var initial + var final + + while (++index < length) { + row = rows[index] + + if (!generated(row)) { + cells = row.children + head = cells[0] + tail = cells[cells.length - 1] + initial = contents.slice(start(row).offset, start(head).offset) + final = contents.slice(end(tail).offset, end(row).offset) + + if (initial.indexOf('|') === -1) { + file.message(reasonStart, start(row)) + } + + if (final.indexOf('|') === -1) { + file.message(reasonEnd, end(row)) + } + } + } + } +} diff --git a/node_modules/remark-lint-table-pipes/package.json b/node_modules/remark-lint-table-pipes/package.json new file mode 100644 index 00000000..b31d60ca --- /dev/null +++ b/node_modules/remark-lint-table-pipes/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-table-pipes@^1.0.0", + "_id": "remark-lint-table-pipes@1.0.4", + "_inBundle": false, + "_integrity": "sha512-0fdnoiiSLIPd/76gNvQY4pg27d8HkMmmv5gCGfD+Z/Si9DdpbJdq93U0kX+Botb3+/4VEDIlcU7Cp5HXppMTWA==", + "_location": "/remark-lint-table-pipes", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-table-pipes@^1.0.0", + "name": "remark-lint-table-pipes", + "escapedName": "remark-lint-table-pipes", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-1.0.4.tgz", + "_shasum": "b8cd860a3098385bbdbd4b1f9b34ac6cfed16035", + "_spec": "remark-lint-table-pipes@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when table rows are not fenced with pipes", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "table", + "row", + "pipe" + ], + "license": "MIT", + "name": "remark-lint-table-pipes", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-table-pipes" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-table-pipes/readme.md b/node_modules/remark-lint-table-pipes/readme.md new file mode 100644 index 00000000..9dd873e0 --- /dev/null +++ b/node_modules/remark-lint-table-pipes/readme.md @@ -0,0 +1,166 @@ + + +# remark-lint-table-pipes + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when table rows are not fenced with pipes. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +creates fenced rows with initial and final pipes by default. +Pass +[`looseTable: true`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsloosetable) +to not use row fences. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +A | B +----- | ----- +Alpha | Bravo +``` + +###### Out + +```text +1:1: Missing initial pipe in table fence +1:10: Missing final pipe in table fence +3:1: Missing initial pipe in table fence +3:14: Missing final pipe in table fence +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-table-pipes +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-table-pipes", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-table-pipes readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-table-pipes')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-table-pipes.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-table-pipes + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-table-pipes.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-table-pipes + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint-unordered-list-marker-style/index.js b/node_modules/remark-lint-unordered-list-marker-style/index.js new file mode 100644 index 00000000..3576eff0 --- /dev/null +++ b/node_modules/remark-lint-unordered-list-marker-style/index.js @@ -0,0 +1,131 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module unordered-list-marker-style + * @fileoverview + * Warn when the list item marker style of unordered lists violate a given + * style. + * + * Options: `'consistent'`, `'-'`, `'*'`, or `'*'`, default: `'consistent'`. + * + * `'consistent'` detects the first used list style and warns when subsequent + * lists use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats unordered lists using `-` (hyphen-minus) by default. + * Pass + * [`bullet: '*'` or `bullet: '+'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsbullet) + * to use `*` (asterisk) or `+` (plus sign) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * By default (`'consistent'`), if the file uses only one marker, + * that’s OK. + * + * * Foo + * * Bar + * * Baz + * + * Ordered lists are not affected. + * + * 1. Foo + * 2. Bar + * 3. Baz + * + * @example {"name": "ok.md", "setting": "*"} + * + * * Foo + * + * @example {"name": "ok.md", "setting": "-"} + * + * - Foo + * + * @example {"name": "ok.md", "setting": "+"} + * + * + Foo + * + * @example {"name": "not-ok.md", "label": "input"} + * + * * Foo + * - Bar + * + Baz + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:1-2:6: Marker style should be `*` + * 3:1-3:6: Marker style should be `*` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect unordered list item marker style `💩`: use either `'-'`, `'*'`, or `'+'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:unordered-list-marker-style', + unorderedListMarkerStyle +) + +var start = position.start + +var styles = { + '-': true, + '*': true, + '+': true, + null: true +} + +function unorderedListMarkerStyle(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect unordered list item marker style `' + + preferred + + "`: use either `'-'`, `'*'`, or `'+'`" + ) + } + + visit(tree, 'list', visitor) + + function visitor(node) { + var children = node.children + var length = node.ordered ? 0 : children.length + var index = -1 + var child + var marker + + while (++index < length) { + child = children[index] + + if (!generated(child)) { + marker = contents + .slice(start(child).offset, start(child.children[0]).offset) + .replace(/\[[x ]?]\s*$/i, '') + .replace(/\s/g, '') + + if (preferred) { + if (marker !== preferred) { + file.message('Marker style should be `' + preferred + '`', child) + } + } else { + preferred = marker + } + } + } + } +} diff --git a/node_modules/remark-lint-unordered-list-marker-style/package.json b/node_modules/remark-lint-unordered-list-marker-style/package.json new file mode 100644 index 00000000..6b4d5ac2 --- /dev/null +++ b/node_modules/remark-lint-unordered-list-marker-style/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-unordered-list-marker-style@^1.0.0", + "_id": "remark-lint-unordered-list-marker-style@1.0.4", + "_inBundle": false, + "_integrity": "sha512-lcuG1J74VGTT4gl8oH33HpkHrqorxjxMlJnBupLFrVowqvJ2hAq8yPJdGZ7P46uZOYw+Xz+Qv08bF8A73PNWxQ==", + "_location": "/remark-lint-unordered-list-marker-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-unordered-list-marker-style@^1.0.0", + "name": "remark-lint-unordered-list-marker-style", + "escapedName": "remark-lint-unordered-list-marker-style", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-unordered-list-marker-style/-/remark-lint-unordered-list-marker-style-1.0.4.tgz", + "_shasum": "c4952f929a96d82a0e18d86a32b70ea454523c85", + "_spec": "remark-lint-unordered-list-marker-style@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when markers of unordered lists violate a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "ordered", + "list", + "marker" + ], + "license": "MIT", + "name": "remark-lint-unordered-list-marker-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-unordered-list-marker-style" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-lint-unordered-list-marker-style/readme.md b/node_modules/remark-lint-unordered-list-marker-style/readme.md new file mode 100644 index 00000000..5f6f61b7 --- /dev/null +++ b/node_modules/remark-lint-unordered-list-marker-style/readme.md @@ -0,0 +1,231 @@ + + +# remark-lint-unordered-list-marker-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the list item marker style of unordered lists violate a given +style. + +Options: `'consistent'`, `'-'`, `'*'`, or `'*'`, default: `'consistent'`. + +`'consistent'` detects the first used list style and warns when subsequent +lists use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +formats unordered lists using `-` (hyphen-minus) by default. +Pass +[`bullet: '*'` or `bullet: '+'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsbullet) +to use `*` (asterisk) or `+` (plus sign) instead. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'-'` | + +## Example + +##### `ok.md` + +###### In + +```markdown +By default (`'consistent'`), if the file uses only one marker, +that’s OK. + +* Foo +* Bar +* Baz + +Ordered lists are not affected. + +1. Foo +2. Bar +3. Baz +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +* Foo +- Bar ++ Baz +``` + +###### Out + +```text +2:1-2:6: Marker style should be `*` +3:1-3:6: Marker style should be `*` +``` + +##### `ok.md` + +When configured with `'*'`. + +###### In + +```markdown +* Foo +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'-'`. + +###### In + +```markdown +- Foo +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'+'`. + +###### In + +```markdown ++ Foo +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect unordered list item marker style `💩`: use either `'-'`, `'*'`, or `'+'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-unordered-list-marker-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-unordered-list-marker-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-unordered-list-marker-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-unordered-list-marker-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-unordered-list-marker-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-unordered-list-marker-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-unordered-list-marker-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-unordered-list-marker-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-lint/index.js b/node_modules/remark-lint/index.js new file mode 100644 index 00000000..e26876db --- /dev/null +++ b/node_modules/remark-lint/index.js @@ -0,0 +1,16 @@ +'use strict' + +var control = require('remark-message-control') + +module.exports = lint + +/* `remark-lint`. This adds support for ignoring stuff from + * messages (``). + * All rules are in their own packages and presets. */ +function lint() { + this.use(lintMessageControl) +} + +function lintMessageControl() { + return control({name: 'lint', source: 'remark-lint'}) +} diff --git a/node_modules/remark-lint/package.json b/node_modules/remark-lint/package.json new file mode 100644 index 00000000..953154ca --- /dev/null +++ b/node_modules/remark-lint/package.json @@ -0,0 +1,66 @@ +{ + "_from": "remark-lint@6.0.2", + "_id": "remark-lint@6.0.2", + "_inBundle": false, + "_integrity": "sha512-zrIx7InZLLOUYUViT6lSa8T80pDyl3Ywvliog+4hoc7LoiJZRV74ejq+RBZK70bg/p2dU/CV6ycedgypFFePPg==", + "_location": "/remark-lint", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "remark-lint@6.0.2", + "name": "remark-lint", + "escapedName": "remark-lint", + "rawSpec": "6.0.2", + "saveSpec": null, + "fetchSpec": "6.0.2" + }, + "_requiredBy": [ + "#USER", + "/", + "/remark-preset-lint-markdown-style-guide", + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-6.0.2.tgz", + "_shasum": "f4ac45536e4fbf3c9a523dfa1cca874c598554de", + "_spec": "remark-lint@6.0.2", + "_where": "/home/remi/github/CPP_BIDS", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "remark-message-control": "^4.0.0" + }, + "deprecated": false, + "description": "Lint markdown with remark", + "files": [ + "index.js" + ], + "keywords": [ + "markdown", + "lint", + "validate", + "remark" + ], + "license": "MIT", + "name": "remark-lint", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint" + }, + "version": "6.0.2", + "xo": false +} diff --git a/node_modules/remark-lint/readme.md b/node_modules/remark-lint/readme.md new file mode 100644 index 00000000..32b92912 --- /dev/null +++ b/node_modules/remark-lint/readme.md @@ -0,0 +1,51 @@ +# ![remark-lint][logo] + +[![Build Status][build-badge]][build-status] +[![Coverage Status][coverage-badge]][coverage-status] +[![Chat][chat-badge]][chat] + +`remark-lint` is a markdown code style linter built on [**remark**][remark], a +powerful markdown processor powered by [plugins][]. + +Read more about `remark-lint` on [the monorepo readme][repo]. + +This package doesn’t do much other than [suppressing messages][suppres] through +comments. + +## Install + +```sh +npm install remark-lint +``` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[logo]: https://cdn.rawgit.com/remarkjs/remark-lint/b177ac6/logo.svg + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint.svg + +[build-status]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage-status]: https://codecov.io/github/remarkjs/remark-lint + +[chat-badge]: https://img.shields.io/gitter/room/remarkjs/remark.svg + +[chat]: https://gitter.im/remarkjs/remark + +[repo]: https://github.com/remarkjs/remark-lint#readme + +[remark]: https://github.com/remarkjs/remark + +[plugins]: https://github.com/remarkjs/remark/blob/master/doc/plugins.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/LICENSE + +[author]: http://wooorm.com + +[suppres]: https://github.com/remarkjs/remark-lint#configuring-remark-lint diff --git a/node_modules/remark-message-control/index.js b/node_modules/remark-message-control/index.js new file mode 100644 index 00000000..a028b541 --- /dev/null +++ b/node_modules/remark-message-control/index.js @@ -0,0 +1,16 @@ +'use strict' + +var control = require('unified-message-control') +var marker = require('mdast-comment-marker') +var xtend = require('xtend') + +module.exports = messageControl + +var test = [ + 'html', // Comments are `html` nodes in mdast. + 'comment' // In MDX, comments have their own node. +] + +function messageControl(options) { + return control(xtend({marker: marker, test: test}, options)) +} diff --git a/node_modules/remark-message-control/license b/node_modules/remark-message-control/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-message-control/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-message-control/package.json b/node_modules/remark-message-control/package.json new file mode 100644 index 00000000..7fd81b0b --- /dev/null +++ b/node_modules/remark-message-control/package.json @@ -0,0 +1,124 @@ +{ + "_from": "remark-message-control@^4.0.0", + "_id": "remark-message-control@4.2.0", + "_inBundle": false, + "_integrity": "sha512-WXH2t5ljTyhsXlK1zPBLF3iPHbXl58R94phPMreS1xcHWBZJt6Oiu8RtNjy1poZFb3PqKnbYLJeR/CWcZ1bTFw==", + "_location": "/remark-message-control", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-message-control@^4.0.0", + "name": "remark-message-control", + "escapedName": "remark-message-control", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-lint" + ], + "_resolved": "https://registry.npmjs.org/remark-message-control/-/remark-message-control-4.2.0.tgz", + "_shasum": "184c4a69ce6c4c707a5633fa35b0ce3dbf81f22c", + "_spec": "remark-message-control@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-message-control/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": { + "mdast-comment-marker": "^1.0.0", + "unified-message-control": "^1.0.0", + "xtend": "^4.0.1" + }, + "deprecated": false, + "description": "remark plugin to enable, disable, and ignore messages with remark", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^14.0.0", + "prettier": "^1.0.0", + "remark": "^10.0.0", + "remark-cli": "^6.0.0", + "remark-preset-wooorm": "^5.0.0", + "remark-toc": "^5.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.24.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/remarkjs/remark-message-control#readme", + "keywords": [ + "unified", + "remark", + "plugin", + "mdast", + "markdown", + "comment", + "message", + "marker", + "control" + ], + "license": "MIT", + "name": "remark-message-control", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/remarkjs/remark-message-control.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s remarkMessageControl > remark-message-control.js", + "build-mangle": "browserify . -s remarkMessageControl -p tinyify > remark-message-control.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "4.2.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "guard-for-in": "off" + }, + "ignores": [ + "remark-message-control.js" + ] + } +} diff --git a/node_modules/remark-message-control/readme.md b/node_modules/remark-message-control/readme.md new file mode 100644 index 00000000..f2dbcd4b --- /dev/null +++ b/node_modules/remark-message-control/readme.md @@ -0,0 +1,214 @@ +# remark-message-control + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**remark**][remark] plugin to enable, disable, and ignore messages. + +## Install + +[npm][]: + +```sh +npm install remark-message-control +``` + +## Use + +Say we have the following file, `example.md`: + +```markdown + + +## Heading +``` + +And our script, `example.js`, looks as follows: + +```js +var vfile = require('to-vfile') +var report = require('vfile-reporter') +var remark = require('remark') +var control = require('remark-message-control') + +remark() + .use(warn) + .use(control, {name: 'foo'}) + .process(vfile.readSync('example.md'), function(err, file) { + console.error(report(err || file)) + }) + +function warn() { + return function(tree, file) { + file.message('Whoops!', tree.children[1], 'foo:thing') + } +} +``` + +Now, running `node example` yields: + +```markdown +example.md: no issues found +``` + +## API + +### `remark().use(control, options)` + +Let comment markers control messages from a certain sources. + +##### Options + +###### `options.name` + +Name of markers that can control the message sources (`string`). + +For example, `{name: 'alpha'}` controls `alpha` markers: + +```markdown + +``` + +###### `options.known` + +List of allowed `ruleId`s (`Array.`, optional). +When given, a warning is shown when someone tries to control an unknown rule. + +For example, `{name: 'alpha', known: ['bravo']}` results in a warning if +`charlie` is configured: + +```markdown + +``` + +###### `options.reset` + +Whether to treat all messages as turned off initially (`boolean`, default: +`false`). + +###### `options.enable` + +List of `ruleId`s to initially turn on if `reset: true` (`Array.`, +optional). +By default (`reset: false`), all rules are turned on. + +###### `options.disable` + +List of `ruleId`s to turn on if `reset: false` (`Array.`, optional). + +###### `options.sources` + +Sources that can be controlled with `name` markers (`string` or +`Array.`, default: `options.name`). + +### Markers + +###### `disable` + +The **disable** keyword turns off all messages of the given rule identifiers. +When without identifiers, all messages are turned off. + +For example, to turn off certain messages: + +```md + + +* **foo** + +A paragraph, and now another list. + + * __bar__ +``` + +###### `enable` + +The **enable** keyword turns on all messages of the given rule identifiers. +When without identifiers, all messages are turned on. + +For example, to enable certain messages: + +```md + + +**foo** and __bar__. +``` + +###### `ignore` + +The **ignore** keyword turns off all messages of the given `ruleId`s occurring +in the following node. +When without `ruleId`s, all messages are ignored. + +After the end of the following node, messages are turned on again. + +For example, to turn off certain messages for the next node: + +```md + + +* **foo** + * __bar__ +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [Code of Conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-message-control/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-message-control + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-message-control.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-message-control + +[downloads-badge]: https://img.shields.io/npm/dm/remark-message-control.svg + +[downloads]: https://www.npmjs.com/package/remark-message-control + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-message-control.svg + +[size]: https://bundlephobia.com/result?p=remark-message-control + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: license + +[author]: https://wooorm.com + +[remark]: https://github.com/remarkjs/remark diff --git a/node_modules/remark-parse/index.js b/node_modules/remark-parse/index.js new file mode 100644 index 00000000..1579e355 --- /dev/null +++ b/node_modules/remark-parse/index.js @@ -0,0 +1,14 @@ +'use strict'; + +var unherit = require('unherit'); +var xtend = require('xtend'); +var Parser = require('./lib/parser.js'); + +module.exports = parse; +parse.Parser = Parser; + +function parse(options) { + var Local = unherit(Parser); + Local.prototype.options = xtend(Local.prototype.options, this.data('settings'), options); + this.Parser = Local; +} diff --git a/node_modules/remark-parse/lib/block-elements.json b/node_modules/remark-parse/lib/block-elements.json new file mode 100644 index 00000000..2d13b561 --- /dev/null +++ b/node_modules/remark-parse/lib/block-elements.json @@ -0,0 +1,68 @@ +[ + "address", + "article", + "aside", + "base", + "basefont", + "blockquote", + "body", + "caption", + "center", + "col", + "colgroup", + "dd", + "details", + "dialog", + "dir", + "div", + "dl", + "dt", + "fieldset", + "figcaption", + "figure", + "footer", + "form", + "frame", + "frameset", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "head", + "header", + "hgroup", + "hr", + "html", + "iframe", + "legend", + "li", + "link", + "main", + "menu", + "menuitem", + "meta", + "nav", + "noframes", + "ol", + "optgroup", + "option", + "p", + "param", + "pre", + "section", + "source", + "title", + "summary", + "table", + "tbody", + "td", + "tfoot", + "th", + "thead", + "title", + "tr", + "track", + "ul" +] diff --git a/node_modules/remark-parse/lib/decode.js b/node_modules/remark-parse/lib/decode.js new file mode 100644 index 00000000..fd45b729 --- /dev/null +++ b/node_modules/remark-parse/lib/decode.js @@ -0,0 +1,64 @@ +'use strict'; + +var xtend = require('xtend'); +var entities = require('parse-entities'); + +module.exports = factory; + +/* Factory to create an entity decoder. */ +function factory(ctx) { + decoder.raw = decodeRaw; + + return decoder; + + /* Normalize `position` to add an `indent`. */ + function normalize(position) { + var offsets = ctx.offset; + var line = position.line; + var result = []; + + while (++line) { + if (!(line in offsets)) { + break; + } + + result.push((offsets[line] || 0) + 1); + } + + return { + start: position, + indent: result + }; + } + + /* Handle a warning. + * See https://github.com/wooorm/parse-entities + * for the warnings. */ + function handleWarning(reason, position, code) { + if (code === 3) { + return; + } + + ctx.file.message(reason, position); + } + + /* Decode `value` (at `position`) into text-nodes. */ + function decoder(value, position, handler) { + entities(value, { + position: normalize(position), + warning: handleWarning, + text: handler, + reference: handler, + textContext: ctx, + referenceContext: ctx + }); + } + + /* Decode `value` (at `position`) into a string. */ + function decodeRaw(value, position, options) { + return entities(value, xtend(options, { + position: normalize(position), + warning: handleWarning + })); + } +} diff --git a/node_modules/remark-parse/lib/defaults.js b/node_modules/remark-parse/lib/defaults.js new file mode 100644 index 00000000..37846f39 --- /dev/null +++ b/node_modules/remark-parse/lib/defaults.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + position: true, + gfm: true, + commonmark: false, + footnotes: false, + pedantic: false, + blocks: require('./block-elements.json') +}; diff --git a/node_modules/remark-parse/lib/locate/break.js b/node_modules/remark-parse/lib/locate/break.js new file mode 100644 index 00000000..295bdc98 --- /dev/null +++ b/node_modules/remark-parse/lib/locate/break.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + var index = value.indexOf('\n', fromIndex); + + while (index > fromIndex) { + if (value.charAt(index - 1) !== ' ') { + break; + } + + index--; + } + + return index; +} diff --git a/node_modules/remark-parse/lib/locate/code-inline.js b/node_modules/remark-parse/lib/locate/code-inline.js new file mode 100644 index 00000000..981c8169 --- /dev/null +++ b/node_modules/remark-parse/lib/locate/code-inline.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + return value.indexOf('`', fromIndex); +} diff --git a/node_modules/remark-parse/lib/locate/delete.js b/node_modules/remark-parse/lib/locate/delete.js new file mode 100644 index 00000000..d208aef2 --- /dev/null +++ b/node_modules/remark-parse/lib/locate/delete.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + return value.indexOf('~~', fromIndex); +} diff --git a/node_modules/remark-parse/lib/locate/emphasis.js b/node_modules/remark-parse/lib/locate/emphasis.js new file mode 100644 index 00000000..6a1f2422 --- /dev/null +++ b/node_modules/remark-parse/lib/locate/emphasis.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + var asterisk = value.indexOf('*', fromIndex); + var underscore = value.indexOf('_', fromIndex); + + if (underscore === -1) { + return asterisk; + } + + if (asterisk === -1) { + return underscore; + } + + return underscore < asterisk ? underscore : asterisk; +} diff --git a/node_modules/remark-parse/lib/locate/escape.js b/node_modules/remark-parse/lib/locate/escape.js new file mode 100644 index 00000000..f6c63715 --- /dev/null +++ b/node_modules/remark-parse/lib/locate/escape.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + return value.indexOf('\\', fromIndex); +} diff --git a/node_modules/remark-parse/lib/locate/link.js b/node_modules/remark-parse/lib/locate/link.js new file mode 100644 index 00000000..0f16fd80 --- /dev/null +++ b/node_modules/remark-parse/lib/locate/link.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + var link = value.indexOf('[', fromIndex); + var image = value.indexOf('![', fromIndex); + + if (image === -1) { + return link; + } + + /* Link can never be `-1` if an image is found, so we don’t need + * to check for that :) */ + return link < image ? link : image; +} diff --git a/node_modules/remark-parse/lib/locate/strong.js b/node_modules/remark-parse/lib/locate/strong.js new file mode 100644 index 00000000..da1cac0a --- /dev/null +++ b/node_modules/remark-parse/lib/locate/strong.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + var asterisk = value.indexOf('**', fromIndex); + var underscore = value.indexOf('__', fromIndex); + + if (underscore === -1) { + return asterisk; + } + + if (asterisk === -1) { + return underscore; + } + + return underscore < asterisk ? underscore : asterisk; +} diff --git a/node_modules/remark-parse/lib/locate/tag.js b/node_modules/remark-parse/lib/locate/tag.js new file mode 100644 index 00000000..3c553426 --- /dev/null +++ b/node_modules/remark-parse/lib/locate/tag.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = locate; + +function locate(value, fromIndex) { + return value.indexOf('<', fromIndex); +} diff --git a/node_modules/remark-parse/lib/locate/url.js b/node_modules/remark-parse/lib/locate/url.js new file mode 100644 index 00000000..59b63e25 --- /dev/null +++ b/node_modules/remark-parse/lib/locate/url.js @@ -0,0 +1,26 @@ +'use strict'; + +module.exports = locate; + +var PROTOCOLS = ['https://', 'http://', 'mailto:']; + +function locate(value, fromIndex) { + var length = PROTOCOLS.length; + var index = -1; + var min = -1; + var position; + + if (!this.options.gfm) { + return -1; + } + + while (++index < length) { + position = value.indexOf(PROTOCOLS[index], fromIndex); + + if (position !== -1 && (position < min || min === -1)) { + min = position; + } + } + + return min; +} diff --git a/node_modules/remark-parse/lib/parse.js b/node_modules/remark-parse/lib/parse.js new file mode 100644 index 00000000..5a8d8119 --- /dev/null +++ b/node_modules/remark-parse/lib/parse.js @@ -0,0 +1,45 @@ +'use strict'; + +var xtend = require('xtend'); +var removePosition = require('unist-util-remove-position'); + +module.exports = parse; + +var C_NEWLINE = '\n'; +var EXPRESSION_LINE_BREAKS = /\r\n|\r/g; + +/* Parse the bound file. */ +function parse() { + var self = this; + var value = String(self.file); + var start = {line: 1, column: 1, offset: 0}; + var content = xtend(start); + var node; + + /* Clean non-unix newlines: `\r\n` and `\r` are all + * changed to `\n`. This should not affect positional + * information. */ + value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE); + + if (value.charCodeAt(0) === 0xFEFF) { + value = value.slice(1); + + content.column++; + content.offset++; + } + + node = { + type: 'root', + children: self.tokenizeBlock(value, content), + position: { + start: start, + end: self.eof || xtend(start) + } + }; + + if (!self.options.position) { + removePosition(node, true); + } + + return node; +} diff --git a/node_modules/remark-parse/lib/parser.js b/node_modules/remark-parse/lib/parser.js new file mode 100644 index 00000000..9291109f --- /dev/null +++ b/node_modules/remark-parse/lib/parser.js @@ -0,0 +1,152 @@ +'use strict'; + +var xtend = require('xtend'); +var toggle = require('state-toggle'); +var vfileLocation = require('vfile-location'); +var unescape = require('./unescape'); +var decode = require('./decode'); +var tokenizer = require('./tokenizer'); + +module.exports = Parser; + +function Parser(doc, file) { + this.file = file; + this.offset = {}; + this.options = xtend(this.options); + this.setOptions({}); + + this.inList = false; + this.inBlock = false; + this.inLink = false; + this.atStart = true; + + this.toOffset = vfileLocation(file).toOffset; + this.unescape = unescape(this, 'escape'); + this.decode = decode(this); +} + +var proto = Parser.prototype; + +/* Expose core. */ +proto.setOptions = require('./set-options'); +proto.parse = require('./parse'); + +/* Expose `defaults`. */ +proto.options = require('./defaults'); + +/* Enter and exit helpers. */ +proto.exitStart = toggle('atStart', true); +proto.enterList = toggle('inList', false); +proto.enterLink = toggle('inLink', false); +proto.enterBlock = toggle('inBlock', false); + +/* Nodes that can interupt a paragraph: + * + * ```markdown + * A paragraph, followed by a thematic break. + * ___ + * ``` + * + * In the above example, the thematic break “interupts” + * the paragraph. */ +proto.interruptParagraph = [ + ['thematicBreak'], + ['atxHeading'], + ['fencedCode'], + ['blockquote'], + ['html'], + ['setextHeading', {commonmark: false}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +]; + +/* Nodes that can interupt a list: + * + * ```markdown + * - One + * ___ + * ``` + * + * In the above example, the thematic break “interupts” + * the list. */ +proto.interruptList = [ + ['atxHeading', {pedantic: false}], + ['fencedCode', {pedantic: false}], + ['thematicBreak', {pedantic: false}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +]; + +/* Nodes that can interupt a blockquote: + * + * ```markdown + * > A paragraph. + * ___ + * ``` + * + * In the above example, the thematic break “interupts” + * the blockquote. */ +proto.interruptBlockquote = [ + ['indentedCode', {commonmark: true}], + ['fencedCode', {commonmark: true}], + ['atxHeading', {commonmark: true}], + ['setextHeading', {commonmark: true}], + ['thematicBreak', {commonmark: true}], + ['html', {commonmark: true}], + ['list', {commonmark: true}], + ['definition', {commonmark: false}], + ['footnote', {commonmark: false}] +]; + +/* Handlers. */ +proto.blockTokenizers = { + newline: require('./tokenize/newline'), + indentedCode: require('./tokenize/code-indented'), + fencedCode: require('./tokenize/code-fenced'), + blockquote: require('./tokenize/blockquote'), + atxHeading: require('./tokenize/heading-atx'), + thematicBreak: require('./tokenize/thematic-break'), + list: require('./tokenize/list'), + setextHeading: require('./tokenize/heading-setext'), + html: require('./tokenize/html-block'), + footnote: require('./tokenize/footnote-definition'), + definition: require('./tokenize/definition'), + table: require('./tokenize/table'), + paragraph: require('./tokenize/paragraph') +}; + +proto.inlineTokenizers = { + escape: require('./tokenize/escape'), + autoLink: require('./tokenize/auto-link'), + url: require('./tokenize/url'), + html: require('./tokenize/html-inline'), + link: require('./tokenize/link'), + reference: require('./tokenize/reference'), + strong: require('./tokenize/strong'), + emphasis: require('./tokenize/emphasis'), + deletion: require('./tokenize/delete'), + code: require('./tokenize/code-inline'), + break: require('./tokenize/break'), + text: require('./tokenize/text') +}; + +/* Expose precedence. */ +proto.blockMethods = keys(proto.blockTokenizers); +proto.inlineMethods = keys(proto.inlineTokenizers); + +/* Tokenizers. */ +proto.tokenizeBlock = tokenizer('block'); +proto.tokenizeInline = tokenizer('inline'); +proto.tokenizeFactory = tokenizer; + +/* Get all keys in `value`. */ +function keys(value) { + var result = []; + var key; + + for (key in value) { + result.push(key); + } + + return result; +} diff --git a/node_modules/remark-parse/lib/set-options.js b/node_modules/remark-parse/lib/set-options.js new file mode 100644 index 00000000..c55f7f32 --- /dev/null +++ b/node_modules/remark-parse/lib/set-options.js @@ -0,0 +1,47 @@ +'use strict'; + +var xtend = require('xtend'); +var escapes = require('markdown-escapes'); +var defaults = require('./defaults'); + +module.exports = setOptions; + +function setOptions(options) { + var self = this; + var current = self.options; + var key; + var value; + + if (options == null) { + options = {}; + } else if (typeof options === 'object') { + options = xtend(options); + } else { + throw new Error( + 'Invalid value `' + options + '` ' + + 'for setting `options`' + ); + } + + for (key in defaults) { + value = options[key]; + + if (value == null) { + value = current[key]; + } + + if ( + (key !== 'blocks' && typeof value !== 'boolean') || + (key === 'blocks' && typeof value !== 'object') + ) { + throw new Error('Invalid value `' + value + '` for setting `options.' + key + '`'); + } + + options[key] = value; + } + + self.options = options; + self.escape = escapes(options); + + return self; +} diff --git a/node_modules/remark-parse/lib/tokenize/auto-link.js b/node_modules/remark-parse/lib/tokenize/auto-link.js new file mode 100644 index 00000000..c945a2c1 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/auto-link.js @@ -0,0 +1,145 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); +var decode = require('parse-entities'); +var locate = require('../locate/tag'); + +module.exports = autoLink; +autoLink.locator = locate; +autoLink.notInLink = true; + +var C_LT = '<'; +var C_GT = '>'; +var C_AT_SIGN = '@'; +var C_SLASH = '/'; +var MAILTO = 'mailto:'; +var MAILTO_LENGTH = MAILTO.length; + +/* Tokenise a link. */ +function autoLink(eat, value, silent) { + var self; + var subvalue; + var length; + var index; + var queue; + var character; + var hasAtCharacter; + var link; + var now; + var content; + var tokenizers; + var exit; + + if (value.charAt(0) !== C_LT) { + return; + } + + self = this; + subvalue = ''; + length = value.length; + index = 0; + queue = ''; + hasAtCharacter = false; + link = ''; + + index++; + subvalue = C_LT; + + while (index < length) { + character = value.charAt(index); + + if ( + whitespace(character) || + character === C_GT || + character === C_AT_SIGN || + (character === ':' && value.charAt(index + 1) === C_SLASH) + ) { + break; + } + + queue += character; + index++; + } + + if (!queue) { + return; + } + + link += queue; + queue = ''; + + character = value.charAt(index); + link += character; + index++; + + if (character === C_AT_SIGN) { + hasAtCharacter = true; + } else { + if ( + character !== ':' || + value.charAt(index + 1) !== C_SLASH + ) { + return; + } + + link += C_SLASH; + index++; + } + + while (index < length) { + character = value.charAt(index); + + if (whitespace(character) || character === C_GT) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (!queue || character !== C_GT) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + link += queue; + content = link; + subvalue += link + character; + now = eat.now(); + now.column++; + now.offset++; + + if (hasAtCharacter) { + if (link.slice(0, MAILTO_LENGTH).toLowerCase() === MAILTO) { + content = content.substr(MAILTO_LENGTH); + now.column += MAILTO_LENGTH; + now.offset += MAILTO_LENGTH; + } else { + link = MAILTO + link; + } + } + + /* Temporarily remove all tokenizers except text in autolinks. */ + tokenizers = self.inlineTokenizers; + self.inlineTokenizers = {text: tokenizers.text}; + + exit = self.enterLink(); + + content = self.tokenizeInline(content, now); + + self.inlineTokenizers = tokenizers; + exit(); + + return eat(subvalue)({ + type: 'link', + title: null, + url: decode(link, {nonTerminated: false}), + children: content + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/blockquote.js b/node_modules/remark-parse/lib/tokenize/blockquote.js new file mode 100644 index 00000000..bd700d6a --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/blockquote.js @@ -0,0 +1,129 @@ +'use strict'; + +var trim = require('trim'); +var interrupt = require('../util/interrupt'); + +module.exports = blockquote; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_GT = '>'; + +/* Tokenise a blockquote. */ +function blockquote(eat, value, silent) { + var self = this; + var offsets = self.offset; + var tokenizers = self.blockTokenizers; + var interruptors = self.interruptBlockquote; + var now = eat.now(); + var currentLine = now.line; + var length = value.length; + var values = []; + var contents = []; + var indents = []; + var add; + var index = 0; + var character; + var rest; + var nextIndex; + var content; + var line; + var startIndex; + var prefixed; + var exit; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + index++; + } + + if (value.charAt(index) !== C_GT) { + return; + } + + if (silent) { + return true; + } + + index = 0; + + while (index < length) { + nextIndex = value.indexOf(C_NEWLINE, index); + startIndex = index; + prefixed = false; + + if (nextIndex === -1) { + nextIndex = length; + } + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + index++; + } + + if (value.charAt(index) === C_GT) { + index++; + prefixed = true; + + if (value.charAt(index) === C_SPACE) { + index++; + } + } else { + index = startIndex; + } + + content = value.slice(index, nextIndex); + + if (!prefixed && !trim(content)) { + index = startIndex; + break; + } + + if (!prefixed) { + rest = value.slice(index); + + /* Check if the following code contains a possible + * block. */ + if (interrupt(interruptors, tokenizers, self, [eat, rest, true])) { + break; + } + } + + line = startIndex === index ? content : value.slice(startIndex, nextIndex); + + indents.push(index - startIndex); + values.push(line); + contents.push(content); + + index = nextIndex + 1; + } + + index = -1; + length = indents.length; + add = eat(values.join(C_NEWLINE)); + + while (++index < length) { + offsets[currentLine] = (offsets[currentLine] || 0) + indents[index]; + currentLine++; + } + + exit = self.enterBlock(); + contents = self.tokenizeBlock(contents.join(C_NEWLINE), now); + exit(); + + return add({ + type: 'blockquote', + children: contents + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/break.js b/node_modules/remark-parse/lib/tokenize/break.js new file mode 100644 index 00000000..eb531342 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/break.js @@ -0,0 +1,40 @@ +'use strict'; + +var locate = require('../locate/break'); + +module.exports = hardBreak; +hardBreak.locator = locate; + +var MIN_BREAK_LENGTH = 2; + +function hardBreak(eat, value, silent) { + var length = value.length; + var index = -1; + var queue = ''; + var character; + + while (++index < length) { + character = value.charAt(index); + + if (character === '\n') { + if (index < MIN_BREAK_LENGTH) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + queue += character; + + return eat(queue)({type: 'break'}); + } + + if (character !== ' ') { + return; + } + + queue += character; + } +} diff --git a/node_modules/remark-parse/lib/tokenize/code-fenced.js b/node_modules/remark-parse/lib/tokenize/code-fenced.js new file mode 100644 index 00000000..65f2bc73 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/code-fenced.js @@ -0,0 +1,236 @@ +'use strict'; + +var trim = require('trim-trailing-lines'); + +module.exports = fencedCode; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_TILDE = '~'; +var C_TICK = '`'; + +var MIN_FENCE_COUNT = 3; +var CODE_INDENT_COUNT = 4; + +function fencedCode(eat, value, silent) { + var self = this; + var settings = self.options; + var length = value.length + 1; + var index = 0; + var subvalue = ''; + var fenceCount; + var marker; + var character; + var flag; + var queue; + var content; + var exdentedContent; + var closing; + var exdentedClosing; + var indent; + var now; + + if (!settings.gfm) { + return; + } + + /* Eat initial spacing. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + subvalue += character; + index++; + } + + indent = index; + + /* Eat the fence. */ + character = value.charAt(index); + + if (character !== C_TILDE && character !== C_TICK) { + return; + } + + index++; + marker = character; + fenceCount = 1; + subvalue += character; + + while (index < length) { + character = value.charAt(index); + + if (character !== marker) { + break; + } + + subvalue += character; + fenceCount++; + index++; + } + + if (fenceCount < MIN_FENCE_COUNT) { + return; + } + + /* Eat spacing before flag. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + subvalue += character; + index++; + } + + /* Eat flag. */ + flag = ''; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if ( + character === C_NEWLINE || + character === C_TILDE || + character === C_TICK + ) { + break; + } + + if (character === C_SPACE || character === C_TAB) { + queue += character; + } else { + flag += queue + character; + queue = ''; + } + + index++; + } + + character = value.charAt(index); + + if (character && character !== C_NEWLINE) { + return; + } + + if (silent) { + return true; + } + + now = eat.now(); + now.column += subvalue.length; + now.offset += subvalue.length; + + subvalue += flag; + flag = self.decode.raw(self.unescape(flag), now); + + if (queue) { + subvalue += queue; + } + + queue = ''; + closing = ''; + exdentedClosing = ''; + content = ''; + exdentedContent = ''; + + /* Eat content. */ + while (index < length) { + character = value.charAt(index); + content += closing; + exdentedContent += exdentedClosing; + closing = ''; + exdentedClosing = ''; + + if (character !== C_NEWLINE) { + content += character; + exdentedClosing += character; + index++; + continue; + } + + /* Add the newline to `subvalue` if its the first + * character. Otherwise, add it to the `closing` + * queue. */ + if (content) { + closing += character; + exdentedClosing += character; + } else { + subvalue += character; + } + + queue = ''; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE) { + break; + } + + queue += character; + index++; + } + + closing += queue; + exdentedClosing += queue.slice(indent); + + if (queue.length >= CODE_INDENT_COUNT) { + continue; + } + + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== marker) { + break; + } + + queue += character; + index++; + } + + closing += queue; + exdentedClosing += queue; + + if (queue.length < fenceCount) { + continue; + } + + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + closing += character; + exdentedClosing += character; + index++; + } + + if (!character || character === C_NEWLINE) { + break; + } + } + + subvalue += content + closing; + + return eat(subvalue)({ + type: 'code', + lang: flag || null, + value: trim(exdentedContent) + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/code-indented.js b/node_modules/remark-parse/lib/tokenize/code-indented.js new file mode 100644 index 00000000..c73849d9 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/code-indented.js @@ -0,0 +1,98 @@ +'use strict'; + +var repeat = require('repeat-string'); +var trim = require('trim-trailing-lines'); + +module.exports = indentedCode; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; + +var CODE_INDENT_COUNT = 4; +var CODE_INDENT = repeat(C_SPACE, CODE_INDENT_COUNT); + +/* Tokenise indented code. */ +function indentedCode(eat, value, silent) { + var index = -1; + var length = value.length; + var subvalue = ''; + var content = ''; + var subvalueQueue = ''; + var contentQueue = ''; + var character; + var blankQueue; + var indent; + + while (++index < length) { + character = value.charAt(index); + + if (indent) { + indent = false; + + subvalue += subvalueQueue; + content += contentQueue; + subvalueQueue = ''; + contentQueue = ''; + + if (character === C_NEWLINE) { + subvalueQueue = character; + contentQueue = character; + } else { + subvalue += character; + content += character; + + while (++index < length) { + character = value.charAt(index); + + if (!character || character === C_NEWLINE) { + contentQueue = character; + subvalueQueue = character; + break; + } + + subvalue += character; + content += character; + } + } + } else if ( + character === C_SPACE && + value.charAt(index + 1) === character && + value.charAt(index + 2) === character && + value.charAt(index + 3) === character + ) { + subvalueQueue += CODE_INDENT; + index += 3; + indent = true; + } else if (character === C_TAB) { + subvalueQueue += character; + indent = true; + } else { + blankQueue = ''; + + while (character === C_TAB || character === C_SPACE) { + blankQueue += character; + character = value.charAt(++index); + } + + if (character !== C_NEWLINE) { + break; + } + + subvalueQueue += blankQueue + character; + contentQueue += character; + } + } + + if (content) { + if (silent) { + return true; + } + + return eat(subvalue)({ + type: 'code', + lang: null, + value: trim(content) + }); + } +} diff --git a/node_modules/remark-parse/lib/tokenize/code-inline.js b/node_modules/remark-parse/lib/tokenize/code-inline.js new file mode 100644 index 00000000..c0a496b4 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/code-inline.js @@ -0,0 +1,112 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/code-inline'); + +module.exports = inlineCode; +inlineCode.locator = locate; + +var C_TICK = '`'; + +/* Tokenise inline code. */ +function inlineCode(eat, value, silent) { + var length = value.length; + var index = 0; + var queue = ''; + var tickQueue = ''; + var contentQueue; + var subqueue; + var count; + var openingCount; + var subvalue; + var character; + var found; + var next; + + while (index < length) { + if (value.charAt(index) !== C_TICK) { + break; + } + + queue += C_TICK; + index++; + } + + if (!queue) { + return; + } + + subvalue = queue; + openingCount = index; + queue = ''; + next = value.charAt(index); + count = 0; + + while (index < length) { + character = next; + next = value.charAt(index + 1); + + if (character === C_TICK) { + count++; + tickQueue += character; + } else { + count = 0; + queue += character; + } + + if (count && next !== C_TICK) { + if (count === openingCount) { + subvalue += queue + tickQueue; + found = true; + break; + } + + queue += tickQueue; + tickQueue = ''; + } + + index++; + } + + if (!found) { + if (openingCount % 2 !== 0) { + return; + } + + queue = ''; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + contentQueue = ''; + subqueue = ''; + length = queue.length; + index = -1; + + while (++index < length) { + character = queue.charAt(index); + + if (whitespace(character)) { + subqueue += character; + continue; + } + + if (subqueue) { + if (contentQueue) { + contentQueue += subqueue; + } + + subqueue = ''; + } + + contentQueue += character; + } + + return eat(subvalue)({ + type: 'inlineCode', + value: contentQueue + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/definition.js b/node_modules/remark-parse/lib/tokenize/definition.js new file mode 100644 index 00000000..1cce274c --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/definition.js @@ -0,0 +1,278 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); +var normalize = require('../util/normalize'); + +module.exports = definition; +definition.notInList = true; +definition.notInBlock = true; + +var C_DOUBLE_QUOTE = '"'; +var C_SINGLE_QUOTE = '\''; +var C_BACKSLASH = '\\'; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; +var C_PAREN_OPEN = '('; +var C_PAREN_CLOSE = ')'; +var C_COLON = ':'; +var C_LT = '<'; +var C_GT = '>'; + +function definition(eat, value, silent) { + var self = this; + var commonmark = self.options.commonmark; + var index = 0; + var length = value.length; + var subvalue = ''; + var beforeURL; + var beforeTitle; + var queue; + var character; + var test; + var identifier; + var url; + var title; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + break; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + + if (character !== C_BRACKET_OPEN) { + return; + } + + index++; + subvalue += character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE) { + break; + } else if (character === C_BACKSLASH) { + queue += character; + index++; + character = value.charAt(index); + } + + queue += character; + index++; + } + + if ( + !queue || + value.charAt(index) !== C_BRACKET_CLOSE || + value.charAt(index + 1) !== C_COLON + ) { + return; + } + + identifier = queue; + subvalue += queue + C_BRACKET_CLOSE + C_COLON; + index = subvalue.length; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if ( + character !== C_TAB && + character !== C_SPACE && + character !== C_NEWLINE + ) { + break; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + queue = ''; + beforeURL = subvalue; + + if (character === C_LT) { + index++; + + while (index < length) { + character = value.charAt(index); + + if (!isEnclosedURLCharacter(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (character === isEnclosedURLCharacter.delimiter) { + subvalue += C_LT + queue + character; + index++; + } else { + if (commonmark) { + return; + } + + index -= queue.length + 1; + queue = ''; + } + } + + if (!queue) { + while (index < length) { + character = value.charAt(index); + + if (!isUnclosedURLCharacter(character)) { + break; + } + + queue += character; + index++; + } + + subvalue += queue; + } + + if (!queue) { + return; + } + + url = queue; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if ( + character !== C_TAB && + character !== C_SPACE && + character !== C_NEWLINE + ) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + test = null; + + if (character === C_DOUBLE_QUOTE) { + test = C_DOUBLE_QUOTE; + } else if (character === C_SINGLE_QUOTE) { + test = C_SINGLE_QUOTE; + } else if (character === C_PAREN_OPEN) { + test = C_PAREN_CLOSE; + } + + if (!test) { + queue = ''; + index = subvalue.length; + } else if (queue) { + subvalue += queue + character; + index = subvalue.length; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === test) { + break; + } + + if (character === C_NEWLINE) { + index++; + character = value.charAt(index); + + if (character === C_NEWLINE || character === test) { + return; + } + + queue += C_NEWLINE; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (character !== test) { + return; + } + + beforeTitle = subvalue; + subvalue += queue + character; + index++; + title = queue; + queue = ''; + } else { + return; + } + + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB && character !== C_SPACE) { + break; + } + + subvalue += character; + index++; + } + + character = value.charAt(index); + + if (!character || character === C_NEWLINE) { + if (silent) { + return true; + } + + beforeURL = eat(beforeURL).test().end; + url = self.decode.raw(self.unescape(url), beforeURL, {nonTerminated: false}); + + if (title) { + beforeTitle = eat(beforeTitle).test().end; + title = self.decode.raw(self.unescape(title), beforeTitle); + } + + return eat(subvalue)({ + type: 'definition', + identifier: normalize(identifier), + title: title || null, + url: url + }); + } +} + +/* Check if `character` can be inside an enclosed URI. */ +function isEnclosedURLCharacter(character) { + return character !== C_GT && + character !== C_BRACKET_OPEN && + character !== C_BRACKET_CLOSE; +} + +isEnclosedURLCharacter.delimiter = C_GT; + +/* Check if `character` can be inside an unclosed URI. */ +function isUnclosedURLCharacter(character) { + return character !== C_BRACKET_OPEN && + character !== C_BRACKET_CLOSE && + !whitespace(character); +} diff --git a/node_modules/remark-parse/lib/tokenize/delete.js b/node_modules/remark-parse/lib/tokenize/delete.js new file mode 100644 index 00000000..ca7c68a8 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/delete.js @@ -0,0 +1,60 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/delete'); + +module.exports = strikethrough; +strikethrough.locator = locate; + +var C_TILDE = '~'; +var DOUBLE = '~~'; + +function strikethrough(eat, value, silent) { + var self = this; + var character = ''; + var previous = ''; + var preceding = ''; + var subvalue = ''; + var index; + var length; + var now; + + if ( + !self.options.gfm || + value.charAt(0) !== C_TILDE || + value.charAt(1) !== C_TILDE || + whitespace(value.charAt(2)) + ) { + return; + } + + index = 1; + length = value.length; + now = eat.now(); + now.column += 2; + now.offset += 2; + + while (++index < length) { + character = value.charAt(index); + + if ( + character === C_TILDE && + previous === C_TILDE && + (!preceding || !whitespace(preceding)) + ) { + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + return eat(DOUBLE + subvalue + DOUBLE)({ + type: 'delete', + children: self.tokenizeInline(subvalue, now) + }); + } + + subvalue += previous; + preceding = previous; + previous = character; + } +} diff --git a/node_modules/remark-parse/lib/tokenize/emphasis.js b/node_modules/remark-parse/lib/tokenize/emphasis.js new file mode 100644 index 00000000..b2c87b44 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/emphasis.js @@ -0,0 +1,85 @@ +'use strict'; + +var trim = require('trim'); +var word = require('is-word-character'); +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/emphasis'); + +module.exports = emphasis; +emphasis.locator = locate; + +var C_ASTERISK = '*'; +var C_UNDERSCORE = '_'; + +function emphasis(eat, value, silent) { + var self = this; + var index = 0; + var character = value.charAt(index); + var now; + var pedantic; + var marker; + var queue; + var subvalue; + var length; + var prev; + + if (character !== C_ASTERISK && character !== C_UNDERSCORE) { + return; + } + + pedantic = self.options.pedantic; + subvalue = character; + marker = character; + length = value.length; + index++; + queue = ''; + character = ''; + + if (pedantic && whitespace(value.charAt(index))) { + return; + } + + while (index < length) { + prev = character; + character = value.charAt(index); + + if (character === marker && (!pedantic || !whitespace(prev))) { + character = value.charAt(++index); + + if (character !== marker) { + if (!trim(queue) || prev === marker) { + return; + } + + if (!pedantic && marker === C_UNDERSCORE && word(character)) { + queue += marker; + continue; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + now = eat.now(); + now.column++; + now.offset++; + + return eat(subvalue + queue + marker)({ + type: 'emphasis', + children: self.tokenizeInline(queue, now) + }); + } + + queue += marker; + } + + if (!pedantic && character === '\\') { + queue += character; + character = value.charAt(++index); + } + + queue += character; + index++; + } +} diff --git a/node_modules/remark-parse/lib/tokenize/escape.js b/node_modules/remark-parse/lib/tokenize/escape.js new file mode 100644 index 00000000..d6f99bcc --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/escape.js @@ -0,0 +1,34 @@ +'use strict'; + +var locate = require('../locate/escape'); + +module.exports = escape; +escape.locator = locate; + +function escape(eat, value, silent) { + var self = this; + var character; + var node; + + if (value.charAt(0) === '\\') { + character = value.charAt(1); + + if (self.escape.indexOf(character) !== -1) { + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + if (character === '\n') { + node = {type: 'break'}; + } else { + node = { + type: 'text', + value: character + }; + } + + return eat('\\' + character)(node); + } + } +} diff --git a/node_modules/remark-parse/lib/tokenize/footnote-definition.js b/node_modules/remark-parse/lib/tokenize/footnote-definition.js new file mode 100644 index 00000000..f48ff9bb --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/footnote-definition.js @@ -0,0 +1,185 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); +var normalize = require('../util/normalize'); + +module.exports = footnoteDefinition; +footnoteDefinition.notInList = true; +footnoteDefinition.notInBlock = true; + +var C_BACKSLASH = '\\'; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; +var C_CARET = '^'; +var C_COLON = ':'; + +var EXPRESSION_INITIAL_TAB = /^( {4}|\t)?/gm; + +function footnoteDefinition(eat, value, silent) { + var self = this; + var offsets = self.offset; + var index; + var length; + var subvalue; + var now; + var currentLine; + var content; + var queue; + var subqueue; + var character; + var identifier; + var add; + var exit; + + if (!self.options.footnotes) { + return; + } + + index = 0; + length = value.length; + subvalue = ''; + now = eat.now(); + currentLine = now.line; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + subvalue += character; + index++; + } + + if ( + value.charAt(index) !== C_BRACKET_OPEN || + value.charAt(index + 1) !== C_CARET + ) { + return; + } + + subvalue += C_BRACKET_OPEN + C_CARET; + index = subvalue.length; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE) { + break; + } else if (character === C_BACKSLASH) { + queue += character; + index++; + character = value.charAt(index); + } + + queue += character; + index++; + } + + if ( + !queue || + value.charAt(index) !== C_BRACKET_CLOSE || + value.charAt(index + 1) !== C_COLON + ) { + return; + } + + if (silent) { + return true; + } + + identifier = normalize(queue); + subvalue += queue + C_BRACKET_CLOSE + C_COLON; + index = subvalue.length; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB && character !== C_SPACE) { + break; + } + + subvalue += character; + index++; + } + + now.column += subvalue.length; + now.offset += subvalue.length; + queue = ''; + content = ''; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === C_NEWLINE) { + subqueue = character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_NEWLINE) { + break; + } + + subqueue += character; + index++; + } + + queue += subqueue; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character !== C_SPACE) { + break; + } + + subqueue += character; + index++; + } + + if (subqueue.length === 0) { + break; + } + + queue += subqueue; + } + + if (queue) { + content += queue; + queue = ''; + } + + content += character; + index++; + } + + subvalue += content; + + content = content.replace(EXPRESSION_INITIAL_TAB, function (line) { + offsets[currentLine] = (offsets[currentLine] || 0) + line.length; + currentLine++; + + return ''; + }); + + add = eat(subvalue); + + exit = self.enterBlock(); + content = self.tokenizeBlock(content, now); + exit(); + + return add({ + type: 'footnoteDefinition', + identifier: identifier, + children: content + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/heading-atx.js b/node_modules/remark-parse/lib/tokenize/heading-atx.js new file mode 100644 index 00000000..aafeabb5 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/heading-atx.js @@ -0,0 +1,141 @@ +'use strict'; + +module.exports = atxHeading; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_HASH = '#'; + +var MAX_ATX_COUNT = 6; + +function atxHeading(eat, value, silent) { + var self = this; + var settings = self.options; + var length = value.length + 1; + var index = -1; + var now = eat.now(); + var subvalue = ''; + var content = ''; + var character; + var queue; + var depth; + + /* Eat initial spacing. */ + while (++index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + index--; + break; + } + + subvalue += character; + } + + /* Eat hashes. */ + depth = 0; + + while (++index <= length) { + character = value.charAt(index); + + if (character !== C_HASH) { + index--; + break; + } + + subvalue += character; + depth++; + } + + if (depth > MAX_ATX_COUNT) { + return; + } + + if ( + !depth || + (!settings.pedantic && value.charAt(index + 1) === C_HASH) + ) { + return; + } + + length = value.length + 1; + + /* Eat intermediate white-space. */ + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character !== C_SPACE && character !== C_TAB) { + index--; + break; + } + + queue += character; + } + + /* Exit when not in pedantic mode without spacing. */ + if ( + !settings.pedantic && + queue.length === 0 && + character && + character !== C_NEWLINE + ) { + return; + } + + if (silent) { + return true; + } + + /* Eat content. */ + subvalue += queue; + queue = ''; + content = ''; + + while (++index < length) { + character = value.charAt(index); + + if (!character || character === C_NEWLINE) { + break; + } + + if ( + character !== C_SPACE && + character !== C_TAB && + character !== C_HASH + ) { + content += queue + character; + queue = ''; + continue; + } + + while (character === C_SPACE || character === C_TAB) { + queue += character; + character = value.charAt(++index); + } + + while (character === C_HASH) { + queue += character; + character = value.charAt(++index); + } + + while (character === C_SPACE || character === C_TAB) { + queue += character; + character = value.charAt(++index); + } + + index--; + } + + now.column += subvalue.length; + now.offset += subvalue.length; + subvalue += content + queue; + + return eat(subvalue)({ + type: 'heading', + depth: depth, + children: self.tokenizeInline(content, now) + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/heading-setext.js b/node_modules/remark-parse/lib/tokenize/heading-setext.js new file mode 100644 index 00000000..96c6130d --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/heading-setext.js @@ -0,0 +1,107 @@ +'use strict'; + +module.exports = setextHeading; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_EQUALS = '='; +var C_DASH = '-'; + +var MAX_HEADING_INDENT = 3; + +/* Map of characters which can be used to mark setext + * headers, mapping to their corresponding depth. */ +var SETEXT_MARKERS = {}; + +SETEXT_MARKERS[C_EQUALS] = 1; +SETEXT_MARKERS[C_DASH] = 2; + +function setextHeading(eat, value, silent) { + var self = this; + var now = eat.now(); + var length = value.length; + var index = -1; + var subvalue = ''; + var content; + var queue; + var character; + var marker; + var depth; + + /* Eat initial indentation. */ + while (++index < length) { + character = value.charAt(index); + + if (character !== C_SPACE || index >= MAX_HEADING_INDENT) { + index--; + break; + } + + subvalue += character; + } + + /* Eat content. */ + content = ''; + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character === C_NEWLINE) { + index--; + break; + } + + if (character === C_SPACE || character === C_TAB) { + queue += character; + } else { + content += queue + character; + queue = ''; + } + } + + now.column += subvalue.length; + now.offset += subvalue.length; + subvalue += content + queue; + + /* Ensure the content is followed by a newline and a + * valid marker. */ + character = value.charAt(++index); + marker = value.charAt(++index); + + if (character !== C_NEWLINE || !SETEXT_MARKERS[marker]) { + return; + } + + subvalue += character; + + /* Eat Setext-line. */ + queue = marker; + depth = SETEXT_MARKERS[marker]; + + while (++index < length) { + character = value.charAt(index); + + if (character !== marker) { + if (character !== C_NEWLINE) { + return; + } + + index--; + break; + } + + queue += character; + } + + if (silent) { + return true; + } + + return eat(subvalue + queue)({ + type: 'heading', + depth: depth, + children: self.tokenizeInline(content, now) + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/html-block.js b/node_modules/remark-parse/lib/tokenize/html-block.js new file mode 100644 index 00000000..6e81eb29 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/html-block.js @@ -0,0 +1,94 @@ +'use strict'; + +var openCloseTag = require('../util/html').openCloseTag; + +module.exports = blockHTML; + +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_NEWLINE = '\n'; +var C_LT = '<'; + +function blockHTML(eat, value, silent) { + var self = this; + var blocks = self.options.blocks; + var length = value.length; + var index = 0; + var next; + var line; + var offset; + var character; + var count; + var sequence; + var subvalue; + + var sequences = [ + [/^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true], + [/^/, true], + [/^<\?/, /\?>/, true], + [/^/, true], + [/^/, true], + [new RegExp('^|$))', 'i'), /^$/, true], + [new RegExp(openCloseTag.source + '\\s*$'), /^$/, false] + ]; + + /* Eat initial spacing. */ + while (index < length) { + character = value.charAt(index); + + if (character !== C_TAB && character !== C_SPACE) { + break; + } + + index++; + } + + if (value.charAt(index) !== C_LT) { + return; + } + + next = value.indexOf(C_NEWLINE, index + 1); + next = next === -1 ? length : next; + line = value.slice(index, next); + offset = -1; + count = sequences.length; + + while (++offset < count) { + if (sequences[offset][0].test(line)) { + sequence = sequences[offset]; + break; + } + } + + if (!sequence) { + return; + } + + if (silent) { + return sequence[2]; + } + + index = next; + + if (!sequence[1].test(line)) { + while (index < length) { + next = value.indexOf(C_NEWLINE, index + 1); + next = next === -1 ? length : next; + line = value.slice(index + 1, next); + + if (sequence[1].test(line)) { + if (line) { + index = next; + } + + break; + } + + index = next; + } + } + + subvalue = value.slice(0, index); + + return eat(subvalue)({type: 'html', value: subvalue}); +} diff --git a/node_modules/remark-parse/lib/tokenize/html-inline.js b/node_modules/remark-parse/lib/tokenize/html-inline.js new file mode 100644 index 00000000..c204e962 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/html-inline.js @@ -0,0 +1,54 @@ +'use strict'; + +var alphabetical = require('is-alphabetical'); +var locate = require('../locate/tag'); +var tag = require('../util/html').tag; + +module.exports = inlineHTML; +inlineHTML.locator = locate; + +var EXPRESSION_HTML_LINK_OPEN = /^/i; + +function inlineHTML(eat, value, silent) { + var self = this; + var length = value.length; + var character; + var subvalue; + + if (value.charAt(0) !== '<' || length < 3) { + return; + } + + character = value.charAt(1); + + if ( + !alphabetical(character) && + character !== '?' && + character !== '!' && + character !== '/' + ) { + return; + } + + subvalue = value.match(tag); + + if (!subvalue) { + return; + } + + /* istanbul ignore if - not used yet. */ + if (silent) { + return true; + } + + subvalue = subvalue[0]; + + if (!self.inLink && EXPRESSION_HTML_LINK_OPEN.test(subvalue)) { + self.inLink = true; + } else if (self.inLink && EXPRESSION_HTML_LINK_CLOSE.test(subvalue)) { + self.inLink = false; + } + + return eat(subvalue)({type: 'html', value: subvalue}); +} diff --git a/node_modules/remark-parse/lib/tokenize/link.js b/node_modules/remark-parse/lib/tokenize/link.js new file mode 100644 index 00000000..3ef5e1ba --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/link.js @@ -0,0 +1,392 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/link'); + +module.exports = link; +link.locator = locate; + +var own = {}.hasOwnProperty; + +var C_BACKSLASH = '\\'; +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; +var C_PAREN_OPEN = '('; +var C_PAREN_CLOSE = ')'; +var C_LT = '<'; +var C_GT = '>'; +var C_TICK = '`'; +var C_DOUBLE_QUOTE = '"'; +var C_SINGLE_QUOTE = '\''; + +/* Map of characters, which can be used to mark link + * and image titles. */ +var LINK_MARKERS = {}; + +LINK_MARKERS[C_DOUBLE_QUOTE] = C_DOUBLE_QUOTE; +LINK_MARKERS[C_SINGLE_QUOTE] = C_SINGLE_QUOTE; + +/* Map of characters, which can be used to mark link + * and image titles in commonmark-mode. */ +var COMMONMARK_LINK_MARKERS = {}; + +COMMONMARK_LINK_MARKERS[C_DOUBLE_QUOTE] = C_DOUBLE_QUOTE; +COMMONMARK_LINK_MARKERS[C_SINGLE_QUOTE] = C_SINGLE_QUOTE; +COMMONMARK_LINK_MARKERS[C_PAREN_OPEN] = C_PAREN_CLOSE; + +function link(eat, value, silent) { + var self = this; + var subvalue = ''; + var index = 0; + var character = value.charAt(0); + var pedantic = self.options.pedantic; + var commonmark = self.options.commonmark; + var gfm = self.options.gfm; + var closed; + var count; + var opening; + var beforeURL; + var beforeTitle; + var subqueue; + var hasMarker; + var markers; + var isImage; + var content; + var marker; + var length; + var title; + var depth; + var queue; + var url; + var now; + var exit; + var node; + + /* Detect whether this is an image. */ + if (character === '!') { + isImage = true; + subvalue = character; + character = value.charAt(++index); + } + + /* Eat the opening. */ + if (character !== C_BRACKET_OPEN) { + return; + } + + /* Exit when this is a link and we’re already inside + * a link. */ + if (!isImage && self.inLink) { + return; + } + + subvalue += character; + queue = ''; + index++; + + /* Eat the content. */ + length = value.length; + now = eat.now(); + depth = 0; + + now.column += index; + now.offset += index; + + while (index < length) { + character = value.charAt(index); + subqueue = character; + + if (character === C_TICK) { + /* Inline-code in link content. */ + count = 1; + + while (value.charAt(index + 1) === C_TICK) { + subqueue += character; + index++; + count++; + } + + if (!opening) { + opening = count; + } else if (count >= opening) { + opening = 0; + } + } else if (character === C_BACKSLASH) { + /* Allow brackets to be escaped. */ + index++; + subqueue += value.charAt(index); + /* In GFM mode, brackets in code still count. + * In all other modes, they don’t. This empty + * block prevents the next statements are + * entered. */ + } else if ((!opening || gfm) && character === C_BRACKET_OPEN) { + depth++; + } else if ((!opening || gfm) && character === C_BRACKET_CLOSE) { + if (depth) { + depth--; + } else { + /* Allow white-space between content and + * url in GFM mode. */ + if (!pedantic) { + while (index < length) { + character = value.charAt(index + 1); + + if (!whitespace(character)) { + break; + } + + subqueue += character; + index++; + } + } + + if (value.charAt(index + 1) !== C_PAREN_OPEN) { + return; + } + + subqueue += C_PAREN_OPEN; + closed = true; + index++; + + break; + } + } + + queue += subqueue; + subqueue = ''; + index++; + } + + /* Eat the content closing. */ + if (!closed) { + return; + } + + content = queue; + subvalue += queue + subqueue; + index++; + + /* Eat white-space. */ + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + subvalue += character; + index++; + } + + /* Eat the URL. */ + character = value.charAt(index); + markers = commonmark ? COMMONMARK_LINK_MARKERS : LINK_MARKERS; + queue = ''; + beforeURL = subvalue; + + if (character === C_LT) { + index++; + beforeURL += C_LT; + + while (index < length) { + character = value.charAt(index); + + if (character === C_GT) { + break; + } + + if (commonmark && character === '\n') { + return; + } + + queue += character; + index++; + } + + if (value.charAt(index) !== C_GT) { + return; + } + + subvalue += C_LT + queue + C_GT; + url = queue; + index++; + } else { + character = null; + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (subqueue && own.call(markers, character)) { + break; + } + + if (whitespace(character)) { + if (!pedantic) { + break; + } + + subqueue += character; + } else { + if (character === C_PAREN_OPEN) { + depth++; + } else if (character === C_PAREN_CLOSE) { + if (depth === 0) { + break; + } + + depth--; + } + + queue += subqueue; + subqueue = ''; + + if (character === C_BACKSLASH) { + queue += C_BACKSLASH; + character = value.charAt(++index); + } + + queue += character; + } + + index++; + } + + subvalue += queue; + url = queue; + index = subvalue.length; + } + + /* Eat white-space. */ + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + subvalue += queue; + + /* Eat the title. */ + if (queue && own.call(markers, character)) { + index++; + subvalue += character; + queue = ''; + marker = markers[character]; + beforeTitle = subvalue; + + /* In commonmark-mode, things are pretty easy: the + * marker cannot occur inside the title. + * + * Non-commonmark does, however, support nested + * delimiters. */ + if (commonmark) { + while (index < length) { + character = value.charAt(index); + + if (character === marker) { + break; + } + + if (character === C_BACKSLASH) { + queue += C_BACKSLASH; + character = value.charAt(++index); + } + + index++; + queue += character; + } + + character = value.charAt(index); + + if (character !== marker) { + return; + } + + title = queue; + subvalue += queue + character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + subvalue += character; + index++; + } + } else { + subqueue = ''; + + while (index < length) { + character = value.charAt(index); + + if (character === marker) { + if (hasMarker) { + queue += marker + subqueue; + subqueue = ''; + } + + hasMarker = true; + } else if (!hasMarker) { + queue += character; + } else if (character === C_PAREN_CLOSE) { + subvalue += queue + marker + subqueue; + title = queue; + break; + } else if (whitespace(character)) { + subqueue += character; + } else { + queue += marker + subqueue + character; + subqueue = ''; + hasMarker = false; + } + + index++; + } + } + } + + if (value.charAt(index) !== C_PAREN_CLOSE) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + subvalue += C_PAREN_CLOSE; + + url = self.decode.raw(self.unescape(url), eat(beforeURL).test().end, {nonTerminated: false}); + + if (title) { + beforeTitle = eat(beforeTitle).test().end; + title = self.decode.raw(self.unescape(title), beforeTitle); + } + + node = { + type: isImage ? 'image' : 'link', + title: title || null, + url: url + }; + + if (isImage) { + node.alt = self.decode.raw(self.unescape(content), now) || null; + } else { + exit = self.enterLink(); + node.children = self.tokenizeInline(content, now); + exit(); + } + + return eat(subvalue)(node); +} diff --git a/node_modules/remark-parse/lib/tokenize/list.js b/node_modules/remark-parse/lib/tokenize/list.js new file mode 100644 index 00000000..9164c816 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/list.js @@ -0,0 +1,474 @@ +'use strict'; + +/* eslint-disable max-params */ + +var trim = require('trim'); +var repeat = require('repeat-string'); +var decimal = require('is-decimal'); +var getIndent = require('../util/get-indentation'); +var removeIndent = require('../util/remove-indentation'); +var interrupt = require('../util/interrupt'); + +module.exports = list; + +var C_ASTERISK = '*'; +var C_UNDERSCORE = '_'; +var C_PLUS = '+'; +var C_DASH = '-'; +var C_DOT = '.'; +var C_SPACE = ' '; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_PAREN_CLOSE = ')'; +var C_X_LOWER = 'x'; + +var TAB_SIZE = 4; +var EXPRESSION_LOOSE_LIST_ITEM = /\n\n(?!\s*$)/; +var EXPRESSION_TASK_ITEM = /^\[([ \t]|x|X)][ \t]/; +var EXPRESSION_BULLET = /^([ \t]*)([*+-]|\d+[.)])( {1,4}(?! )| |\t|$|(?=\n))([^\n]*)/; +var EXPRESSION_PEDANTIC_BULLET = /^([ \t]*)([*+-]|\d+[.)])([ \t]+)/; +var EXPRESSION_INITIAL_INDENT = /^( {1,4}|\t)?/gm; + +/* Map of characters which can be used to mark + * list-items. */ +var LIST_UNORDERED_MARKERS = {}; + +LIST_UNORDERED_MARKERS[C_ASTERISK] = true; +LIST_UNORDERED_MARKERS[C_PLUS] = true; +LIST_UNORDERED_MARKERS[C_DASH] = true; + +/* Map of characters which can be used to mark + * list-items after a digit. */ +var LIST_ORDERED_MARKERS = {}; + +LIST_ORDERED_MARKERS[C_DOT] = true; + +/* Map of characters which can be used to mark + * list-items after a digit. */ +var LIST_ORDERED_COMMONMARK_MARKERS = {}; + +LIST_ORDERED_COMMONMARK_MARKERS[C_DOT] = true; +LIST_ORDERED_COMMONMARK_MARKERS[C_PAREN_CLOSE] = true; + +function list(eat, value, silent) { + var self = this; + var commonmark = self.options.commonmark; + var pedantic = self.options.pedantic; + var tokenizers = self.blockTokenizers; + var interuptors = self.interruptList; + var markers; + var index = 0; + var length = value.length; + var start = null; + var size = 0; + var queue; + var ordered; + var character; + var marker; + var nextIndex; + var startIndex; + var prefixed; + var currentMarker; + var content; + var line; + var prevEmpty; + var empty; + var items; + var allLines; + var emptyLines; + var item; + var enterTop; + var exitBlockquote; + var isLoose; + var node; + var now; + var end; + var indented; + + while (index < length) { + character = value.charAt(index); + + if (character === C_TAB) { + size += TAB_SIZE - (size % TAB_SIZE); + } else if (character === C_SPACE) { + size++; + } else { + break; + } + + index++; + } + + if (size >= TAB_SIZE) { + return; + } + + character = value.charAt(index); + + markers = commonmark ? + LIST_ORDERED_COMMONMARK_MARKERS : + LIST_ORDERED_MARKERS; + + if (LIST_UNORDERED_MARKERS[character] === true) { + marker = character; + ordered = false; + } else { + ordered = true; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!decimal(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + if (!queue || markers[character] !== true) { + return; + } + + start = parseInt(queue, 10); + marker = character; + } + + character = value.charAt(++index); + + if (character !== C_SPACE && character !== C_TAB) { + return; + } + + if (silent) { + return true; + } + + index = 0; + items = []; + allLines = []; + emptyLines = []; + + while (index < length) { + nextIndex = value.indexOf(C_NEWLINE, index); + startIndex = index; + prefixed = false; + indented = false; + + if (nextIndex === -1) { + nextIndex = length; + } + + end = index + TAB_SIZE; + size = 0; + + while (index < length) { + character = value.charAt(index); + + if (character === C_TAB) { + size += TAB_SIZE - (size % TAB_SIZE); + } else if (character === C_SPACE) { + size++; + } else { + break; + } + + index++; + } + + if (size >= TAB_SIZE) { + indented = true; + } + + if (item && size >= item.indent) { + indented = true; + } + + character = value.charAt(index); + currentMarker = null; + + if (!indented) { + if (LIST_UNORDERED_MARKERS[character] === true) { + currentMarker = character; + index++; + size++; + } else { + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!decimal(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + index++; + + if (queue && markers[character] === true) { + currentMarker = character; + size += queue.length + 1; + } + } + + if (currentMarker) { + character = value.charAt(index); + + if (character === C_TAB) { + size += TAB_SIZE - (size % TAB_SIZE); + index++; + } else if (character === C_SPACE) { + end = index + TAB_SIZE; + + while (index < end) { + if (value.charAt(index) !== C_SPACE) { + break; + } + + index++; + size++; + } + + if (index === end && value.charAt(index) === C_SPACE) { + index -= TAB_SIZE - 1; + size -= TAB_SIZE - 1; + } + } else if (character !== C_NEWLINE && character !== '') { + currentMarker = null; + } + } + } + + if (currentMarker) { + if (!pedantic && marker !== currentMarker) { + break; + } + + prefixed = true; + } else { + if (!commonmark && !indented && value.charAt(startIndex) === C_SPACE) { + indented = true; + } else if (commonmark && item) { + indented = size >= item.indent || size > TAB_SIZE; + } + + prefixed = false; + index = startIndex; + } + + line = value.slice(startIndex, nextIndex); + content = startIndex === index ? line : value.slice(index, nextIndex); + + if ( + currentMarker === C_ASTERISK || + currentMarker === C_UNDERSCORE || + currentMarker === C_DASH + ) { + if (tokenizers.thematicBreak.call(self, eat, line, true)) { + break; + } + } + + prevEmpty = empty; + empty = !trim(content).length; + + if (indented && item) { + item.value = item.value.concat(emptyLines, line); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } else if (prefixed) { + if (emptyLines.length !== 0) { + item.value.push(''); + item.trail = emptyLines.concat(); + } + + item = { + value: [line], + indent: size, + trail: [] + }; + + items.push(item); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } else if (empty) { + if (prevEmpty) { + break; + } + + emptyLines.push(line); + } else { + if (prevEmpty) { + break; + } + + if (interrupt(interuptors, tokenizers, self, [eat, line, true])) { + break; + } + + item.value = item.value.concat(emptyLines, line); + allLines = allLines.concat(emptyLines, line); + emptyLines = []; + } + + index = nextIndex + 1; + } + + node = eat(allLines.join(C_NEWLINE)).reset({ + type: 'list', + ordered: ordered, + start: start, + loose: null, + children: [] + }); + + enterTop = self.enterList(); + exitBlockquote = self.enterBlock(); + isLoose = false; + index = -1; + length = items.length; + + while (++index < length) { + item = items[index].value.join(C_NEWLINE); + now = eat.now(); + + item = eat(item)(listItem(self, item, now), node); + + if (item.loose) { + isLoose = true; + } + + item = items[index].trail.join(C_NEWLINE); + + if (index !== length - 1) { + item += C_NEWLINE; + } + + eat(item); + } + + enterTop(); + exitBlockquote(); + + node.loose = isLoose; + + return node; +} + +function listItem(ctx, value, position) { + var offsets = ctx.offset; + var fn = ctx.options.pedantic ? pedanticListItem : normalListItem; + var checked = null; + var task; + var indent; + + value = fn.apply(null, arguments); + + if (ctx.options.gfm) { + task = value.match(EXPRESSION_TASK_ITEM); + + if (task) { + indent = task[0].length; + checked = task[1].toLowerCase() === C_X_LOWER; + offsets[position.line] += indent; + value = value.slice(indent); + } + } + + return { + type: 'listItem', + loose: EXPRESSION_LOOSE_LIST_ITEM.test(value) || + value.charAt(value.length - 1) === C_NEWLINE, + checked: checked, + children: ctx.tokenizeBlock(value, position) + }; +} + +/* Create a list-item using overly simple mechanics. */ +function pedanticListItem(ctx, value, position) { + var offsets = ctx.offset; + var line = position.line; + + /* Remove the list-item’s bullet. */ + value = value.replace(EXPRESSION_PEDANTIC_BULLET, replacer); + + /* The initial line was also matched by the below, so + * we reset the `line`. */ + line = position.line; + + return value.replace(EXPRESSION_INITIAL_INDENT, replacer); + + /* A simple replacer which removed all matches, + * and adds their length to `offset`. */ + function replacer($0) { + offsets[line] = (offsets[line] || 0) + $0.length; + line++; + + return ''; + } +} + +/* Create a list-item using sane mechanics. */ +function normalListItem(ctx, value, position) { + var offsets = ctx.offset; + var line = position.line; + var max; + var bullet; + var rest; + var lines; + var trimmedLines; + var index; + var length; + + /* Remove the list-item’s bullet. */ + value = value.replace(EXPRESSION_BULLET, replacer); + + lines = value.split(C_NEWLINE); + + trimmedLines = removeIndent(value, getIndent(max).indent).split(C_NEWLINE); + + /* We replaced the initial bullet with something + * else above, which was used to trick + * `removeIndentation` into removing some more + * characters when possible. However, that could + * result in the initial line to be stripped more + * than it should be. */ + trimmedLines[0] = rest; + + offsets[line] = (offsets[line] || 0) + bullet.length; + line++; + + index = 0; + length = lines.length; + + while (++index < length) { + offsets[line] = (offsets[line] || 0) + + lines[index].length - trimmedLines[index].length; + line++; + } + + return trimmedLines.join(C_NEWLINE); + + function replacer($0, $1, $2, $3, $4) { + bullet = $1 + $2 + $3; + rest = $4; + + /* Make sure that the first nine numbered list items + * can indent with an extra space. That is, when + * the bullet did not receive an extra final space. */ + if (Number($2) < 10 && bullet.length % 2 === 1) { + $2 = C_SPACE + $2; + } + + max = $1 + repeat(C_SPACE, $2.length) + $3; + + return max + rest; + } +} diff --git a/node_modules/remark-parse/lib/tokenize/newline.js b/node_modules/remark-parse/lib/tokenize/newline.js new file mode 100644 index 00000000..6008670c --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/newline.js @@ -0,0 +1,47 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); + +module.exports = newline; + +/* Tokenise newline. */ +function newline(eat, value, silent) { + var character = value.charAt(0); + var length; + var subvalue; + var queue; + var index; + + if (character !== '\n') { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + index = 1; + length = value.length; + subvalue = character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + queue += character; + + if (character === '\n') { + subvalue += queue; + queue = ''; + } + + index++; + } + + eat(subvalue); +} diff --git a/node_modules/remark-parse/lib/tokenize/paragraph.js b/node_modules/remark-parse/lib/tokenize/paragraph.js new file mode 100644 index 00000000..1492a027 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/paragraph.js @@ -0,0 +1,122 @@ +'use strict'; + +var trim = require('trim'); +var decimal = require('is-decimal'); +var trimTrailingLines = require('trim-trailing-lines'); +var interrupt = require('../util/interrupt'); + +module.exports = paragraph; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; + +var TAB_SIZE = 4; + +/* Tokenise paragraph. */ +function paragraph(eat, value, silent) { + var self = this; + var settings = self.options; + var commonmark = settings.commonmark; + var gfm = settings.gfm; + var tokenizers = self.blockTokenizers; + var interruptors = self.interruptParagraph; + var index = value.indexOf(C_NEWLINE); + var length = value.length; + var position; + var subvalue; + var character; + var size; + var now; + + while (index < length) { + /* Eat everything if there’s no following newline. */ + if (index === -1) { + index = length; + break; + } + + /* Stop if the next character is NEWLINE. */ + if (value.charAt(index + 1) === C_NEWLINE) { + break; + } + + /* In commonmark-mode, following indented lines + * are part of the paragraph. */ + if (commonmark) { + size = 0; + position = index + 1; + + while (position < length) { + character = value.charAt(position); + + if (character === C_TAB) { + size = TAB_SIZE; + break; + } else if (character === C_SPACE) { + size++; + } else { + break; + } + + position++; + } + + if (size >= TAB_SIZE) { + index = value.indexOf(C_NEWLINE, index + 1); + continue; + } + } + + subvalue = value.slice(index + 1); + + /* Check if the following code contains a possible + * block. */ + if (interrupt(interruptors, tokenizers, self, [eat, subvalue, true])) { + break; + } + + /* Break if the following line starts a list, when + * already in a list, or when in commonmark, or when + * in gfm mode and the bullet is *not* numeric. */ + if ( + tokenizers.list.call(self, eat, subvalue, true) && + ( + self.inList || + commonmark || + (gfm && !decimal(trim.left(subvalue).charAt(0))) + ) + ) { + break; + } + + position = index; + index = value.indexOf(C_NEWLINE, index + 1); + + if (index !== -1 && trim(value.slice(position, index)) === '') { + index = position; + break; + } + } + + subvalue = value.slice(0, index); + + if (trim(subvalue) === '') { + eat(subvalue); + + return null; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + now = eat.now(); + subvalue = trimTrailingLines(subvalue); + + return eat(subvalue)({ + type: 'paragraph', + children: self.tokenizeInline(subvalue, now) + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/reference.js b/node_modules/remark-parse/lib/tokenize/reference.js new file mode 100644 index 00000000..50713f1c --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/reference.js @@ -0,0 +1,206 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/link'); +var normalize = require('../util/normalize'); + +module.exports = reference; +reference.locator = locate; + +var T_LINK = 'link'; +var T_IMAGE = 'image'; +var T_FOOTNOTE = 'footnote'; +var REFERENCE_TYPE_SHORTCUT = 'shortcut'; +var REFERENCE_TYPE_COLLAPSED = 'collapsed'; +var REFERENCE_TYPE_FULL = 'full'; +var C_CARET = '^'; +var C_BACKSLASH = '\\'; +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; + +function reference(eat, value, silent) { + var self = this; + var character = value.charAt(0); + var index = 0; + var length = value.length; + var subvalue = ''; + var intro = ''; + var type = T_LINK; + var referenceType = REFERENCE_TYPE_SHORTCUT; + var content; + var identifier; + var now; + var node; + var exit; + var queue; + var bracketed; + var depth; + + /* Check whether we’re eating an image. */ + if (character === '!') { + type = T_IMAGE; + intro = character; + character = value.charAt(++index); + } + + if (character !== C_BRACKET_OPEN) { + return; + } + + index++; + intro += character; + queue = ''; + + /* Check whether we’re eating a footnote. */ + if (self.options.footnotes && value.charAt(index) === C_CARET) { + /* Exit if `![^` is found, so the `!` will be seen as text after this, + * and we’ll enter this function again when `[^` is found. */ + if (type === T_IMAGE) { + return; + } + + intro += C_CARET; + index++; + type = T_FOOTNOTE; + } + + /* Eat the text. */ + depth = 0; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_OPEN) { + bracketed = true; + depth++; + } else if (character === C_BRACKET_CLOSE) { + if (!depth) { + break; + } + + depth--; + } + + if (character === C_BACKSLASH) { + queue += C_BACKSLASH; + character = value.charAt(++index); + } + + queue += character; + index++; + } + + subvalue = queue; + content = queue; + character = value.charAt(index); + + if (character !== C_BRACKET_CLOSE) { + return; + } + + index++; + subvalue += character; + queue = ''; + + while (index < length) { + character = value.charAt(index); + + if (!whitespace(character)) { + break; + } + + queue += character; + index++; + } + + character = value.charAt(index); + + /* Inline footnotes cannot have an identifier. */ + if (type !== T_FOOTNOTE && character === C_BRACKET_OPEN) { + identifier = ''; + queue += character; + index++; + + while (index < length) { + character = value.charAt(index); + + if (character === C_BRACKET_OPEN || character === C_BRACKET_CLOSE) { + break; + } + + if (character === C_BACKSLASH) { + identifier += C_BACKSLASH; + character = value.charAt(++index); + } + + identifier += character; + index++; + } + + character = value.charAt(index); + + if (character === C_BRACKET_CLOSE) { + referenceType = identifier ? REFERENCE_TYPE_FULL : REFERENCE_TYPE_COLLAPSED; + queue += identifier + character; + index++; + } else { + identifier = ''; + } + + subvalue += queue; + queue = ''; + } else { + if (!content) { + return; + } + + identifier = content; + } + + /* Brackets cannot be inside the identifier. */ + if (referenceType !== REFERENCE_TYPE_FULL && bracketed) { + return; + } + + subvalue = intro + subvalue; + + if (type === T_LINK && self.inLink) { + return null; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + if (type === T_FOOTNOTE && content.indexOf(' ') !== -1) { + return eat(subvalue)({ + type: 'footnote', + children: this.tokenizeInline(content, eat.now()) + }); + } + + now = eat.now(); + now.column += intro.length; + now.offset += intro.length; + identifier = referenceType === REFERENCE_TYPE_FULL ? identifier : content; + + node = { + type: type + 'Reference', + identifier: normalize(identifier) + }; + + if (type === T_LINK || type === T_IMAGE) { + node.referenceType = referenceType; + } + + if (type === T_LINK) { + exit = self.enterLink(); + node.children = self.tokenizeInline(content, now); + exit(); + } else if (type === T_IMAGE) { + node.alt = self.decode.raw(self.unescape(content), now) || null; + } + + return eat(subvalue)(node); +} diff --git a/node_modules/remark-parse/lib/tokenize/strong.js b/node_modules/remark-parse/lib/tokenize/strong.js new file mode 100644 index 00000000..12d5785b --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/strong.js @@ -0,0 +1,84 @@ +'use strict'; + +var trim = require('trim'); +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/strong'); + +module.exports = strong; +strong.locator = locate; + +var C_ASTERISK = '*'; +var C_UNDERSCORE = '_'; + +function strong(eat, value, silent) { + var self = this; + var index = 0; + var character = value.charAt(index); + var now; + var pedantic; + var marker; + var queue; + var subvalue; + var length; + var prev; + + if ( + (character !== C_ASTERISK && character !== C_UNDERSCORE) || + value.charAt(++index) !== character + ) { + return; + } + + pedantic = self.options.pedantic; + marker = character; + subvalue = marker + marker; + length = value.length; + index++; + queue = ''; + character = ''; + + if (pedantic && whitespace(value.charAt(index))) { + return; + } + + while (index < length) { + prev = character; + character = value.charAt(index); + + if ( + character === marker && + value.charAt(index + 1) === marker && + (!pedantic || !whitespace(prev)) + ) { + character = value.charAt(index + 2); + + if (character !== marker) { + if (!trim(queue)) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + now = eat.now(); + now.column += 2; + now.offset += 2; + + return eat(subvalue + queue + subvalue)({ + type: 'strong', + children: self.tokenizeInline(queue, now) + }); + } + } + + if (!pedantic && character === '\\') { + queue += character; + character = value.charAt(++index); + } + + queue += character; + index++; + } +} diff --git a/node_modules/remark-parse/lib/tokenize/table.js b/node_modules/remark-parse/lib/tokenize/table.js new file mode 100644 index 00000000..ce93b1d2 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/table.js @@ -0,0 +1,266 @@ +'use strict'; + +var whitespace = require('is-whitespace-character'); + +module.exports = table; + +var C_BACKSLASH = '\\'; +var C_TICK = '`'; +var C_DASH = '-'; +var C_PIPE = '|'; +var C_COLON = ':'; +var C_SPACE = ' '; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; + +var MIN_TABLE_COLUMNS = 1; +var MIN_TABLE_ROWS = 2; + +var TABLE_ALIGN_LEFT = 'left'; +var TABLE_ALIGN_CENTER = 'center'; +var TABLE_ALIGN_RIGHT = 'right'; +var TABLE_ALIGN_NONE = null; + +function table(eat, value, silent) { + var self = this; + var index; + var alignments; + var alignment; + var subvalue; + var row; + var length; + var lines; + var queue; + var character; + var hasDash; + var align; + var cell; + var preamble; + var count; + var opening; + var now; + var position; + var lineCount; + var line; + var rows; + var table; + var lineIndex; + var pipeIndex; + var first; + + /* Exit when not in gfm-mode. */ + if (!self.options.gfm) { + return; + } + + /* Get the rows. + * Detecting tables soon is hard, so there are some + * checks for performance here, such as the minimum + * number of rows, and allowed characters in the + * alignment row. */ + index = 0; + lineCount = 0; + length = value.length + 1; + lines = []; + + while (index < length) { + lineIndex = value.indexOf(C_NEWLINE, index); + pipeIndex = value.indexOf(C_PIPE, index + 1); + + if (lineIndex === -1) { + lineIndex = value.length; + } + + if (pipeIndex === -1 || pipeIndex > lineIndex) { + if (lineCount < MIN_TABLE_ROWS) { + return; + } + + break; + } + + lines.push(value.slice(index, lineIndex)); + lineCount++; + index = lineIndex + 1; + } + + /* Parse the alignment row. */ + subvalue = lines.join(C_NEWLINE); + alignments = lines.splice(1, 1)[0] || []; + index = 0; + length = alignments.length; + lineCount--; + alignment = false; + align = []; + + while (index < length) { + character = alignments.charAt(index); + + if (character === C_PIPE) { + hasDash = null; + + if (alignment === false) { + if (first === false) { + return; + } + } else { + align.push(alignment); + alignment = false; + } + + first = false; + } else if (character === C_DASH) { + hasDash = true; + alignment = alignment || TABLE_ALIGN_NONE; + } else if (character === C_COLON) { + if (alignment === TABLE_ALIGN_LEFT) { + alignment = TABLE_ALIGN_CENTER; + } else if (hasDash && alignment === TABLE_ALIGN_NONE) { + alignment = TABLE_ALIGN_RIGHT; + } else { + alignment = TABLE_ALIGN_LEFT; + } + } else if (!whitespace(character)) { + return; + } + + index++; + } + + if (alignment !== false) { + align.push(alignment); + } + + /* Exit when without enough columns. */ + if (align.length < MIN_TABLE_COLUMNS) { + return; + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + /* Parse the rows. */ + position = -1; + rows = []; + + table = eat(subvalue).reset({ + type: 'table', + align: align, + children: rows + }); + + while (++position < lineCount) { + line = lines[position]; + row = {type: 'tableRow', children: []}; + + /* Eat a newline character when this is not the + * first row. */ + if (position) { + eat(C_NEWLINE); + } + + /* Eat the row. */ + eat(line).reset(row, table); + + length = line.length + 1; + index = 0; + queue = ''; + cell = ''; + preamble = true; + count = null; + opening = null; + + while (index < length) { + character = line.charAt(index); + + if (character === C_TAB || character === C_SPACE) { + if (cell) { + queue += character; + } else { + eat(character); + } + + index++; + continue; + } + + if (character === '' || character === C_PIPE) { + if (preamble) { + eat(character); + } else { + if (character && opening) { + queue += character; + index++; + continue; + } + + if ((cell || character) && !preamble) { + subvalue = cell; + + if (queue.length > 1) { + if (character) { + subvalue += queue.slice(0, queue.length - 1); + queue = queue.charAt(queue.length - 1); + } else { + subvalue += queue; + queue = ''; + } + } + + now = eat.now(); + + eat(subvalue)({ + type: 'tableCell', + children: self.tokenizeInline(cell, now) + }, row); + } + + eat(queue + character); + + queue = ''; + cell = ''; + } + } else { + if (queue) { + cell += queue; + queue = ''; + } + + cell += character; + + if (character === C_BACKSLASH && index !== length - 2) { + cell += line.charAt(index + 1); + index++; + } + + if (character === C_TICK) { + count = 1; + + while (line.charAt(index + 1) === character) { + cell += character; + index++; + count++; + } + + if (!opening) { + opening = count; + } else if (count >= opening) { + opening = 0; + } + } + } + + preamble = false; + index++; + } + + /* Eat the alignment row. */ + if (!position) { + eat(C_NEWLINE + alignments); + } + } + + return table; +} diff --git a/node_modules/remark-parse/lib/tokenize/text.js b/node_modules/remark-parse/lib/tokenize/text.js new file mode 100644 index 00000000..4aedfa90 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/text.js @@ -0,0 +1,58 @@ +'use strict'; + +module.exports = text; + +function text(eat, value, silent) { + var self = this; + var methods; + var tokenizers; + var index; + var length; + var subvalue; + var position; + var tokenizer; + var name; + var min; + var now; + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + methods = self.inlineMethods; + length = methods.length; + tokenizers = self.inlineTokenizers; + index = -1; + min = value.length; + + while (++index < length) { + name = methods[index]; + + if (name === 'text' || !tokenizers[name]) { + continue; + } + + tokenizer = tokenizers[name].locator; + + if (!tokenizer) { + eat.file.fail('Missing locator: `' + name + '`'); + } + + position = tokenizer.call(self, value, 1); + + if (position !== -1 && position < min) { + min = position; + } + } + + subvalue = value.slice(0, min); + now = eat.now(); + + self.decode(subvalue, now, function (content, position, source) { + eat(source || content)({ + type: 'text', + value: content + }); + }); +} diff --git a/node_modules/remark-parse/lib/tokenize/thematic-break.js b/node_modules/remark-parse/lib/tokenize/thematic-break.js new file mode 100644 index 00000000..2391e3f5 --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/thematic-break.js @@ -0,0 +1,70 @@ +'use strict'; + +module.exports = thematicBreak; + +var C_NEWLINE = '\n'; +var C_TAB = '\t'; +var C_SPACE = ' '; +var C_ASTERISK = '*'; +var C_UNDERSCORE = '_'; +var C_DASH = '-'; + +var THEMATIC_BREAK_MARKER_COUNT = 3; + +function thematicBreak(eat, value, silent) { + var index = -1; + var length = value.length + 1; + var subvalue = ''; + var character; + var marker; + var markerCount; + var queue; + + while (++index < length) { + character = value.charAt(index); + + if (character !== C_TAB && character !== C_SPACE) { + break; + } + + subvalue += character; + } + + if ( + character !== C_ASTERISK && + character !== C_DASH && + character !== C_UNDERSCORE + ) { + return; + } + + marker = character; + subvalue += character; + markerCount = 1; + queue = ''; + + while (++index < length) { + character = value.charAt(index); + + if (character === marker) { + markerCount++; + subvalue += queue + marker; + queue = ''; + } else if (character === C_SPACE) { + queue += character; + } else if ( + markerCount >= THEMATIC_BREAK_MARKER_COUNT && + (!character || character === C_NEWLINE) + ) { + subvalue += queue; + + if (silent) { + return true; + } + + return eat(subvalue)({type: 'thematicBreak'}); + } else { + return; + } + } +} diff --git a/node_modules/remark-parse/lib/tokenize/url.js b/node_modules/remark-parse/lib/tokenize/url.js new file mode 100644 index 00000000..297940bf --- /dev/null +++ b/node_modules/remark-parse/lib/tokenize/url.js @@ -0,0 +1,144 @@ +'use strict'; + +var decode = require('parse-entities'); +var whitespace = require('is-whitespace-character'); +var locate = require('../locate/url'); + +module.exports = url; +url.locator = locate; +url.notInLink = true; + +var C_BRACKET_OPEN = '['; +var C_BRACKET_CLOSE = ']'; +var C_PAREN_OPEN = '('; +var C_PAREN_CLOSE = ')'; +var C_LT = '<'; +var C_AT_SIGN = '@'; + +var HTTP_PROTOCOL = 'http://'; +var HTTPS_PROTOCOL = 'https://'; +var MAILTO_PROTOCOL = 'mailto:'; + +var PROTOCOLS = [ + HTTP_PROTOCOL, + HTTPS_PROTOCOL, + MAILTO_PROTOCOL +]; + +var PROTOCOLS_LENGTH = PROTOCOLS.length; + +function url(eat, value, silent) { + var self = this; + var subvalue; + var content; + var character; + var index; + var position; + var protocol; + var match; + var length; + var queue; + var parenCount; + var nextCharacter; + var exit; + + if (!self.options.gfm) { + return; + } + + subvalue = ''; + index = -1; + length = PROTOCOLS_LENGTH; + + while (++index < length) { + protocol = PROTOCOLS[index]; + match = value.slice(0, protocol.length); + + if (match.toLowerCase() === protocol) { + subvalue = match; + break; + } + } + + if (!subvalue) { + return; + } + + index = subvalue.length; + length = value.length; + queue = ''; + parenCount = 0; + + while (index < length) { + character = value.charAt(index); + + if (whitespace(character) || character === C_LT) { + break; + } + + if ( + character === '.' || + character === ',' || + character === ':' || + character === ';' || + character === '"' || + character === '\'' || + character === ')' || + character === ']' + ) { + nextCharacter = value.charAt(index + 1); + + if (!nextCharacter || whitespace(nextCharacter)) { + break; + } + } + + if (character === C_PAREN_OPEN || character === C_BRACKET_OPEN) { + parenCount++; + } + + if (character === C_PAREN_CLOSE || character === C_BRACKET_CLOSE) { + parenCount--; + + if (parenCount < 0) { + break; + } + } + + queue += character; + index++; + } + + if (!queue) { + return; + } + + subvalue += queue; + content = subvalue; + + if (protocol === MAILTO_PROTOCOL) { + position = queue.indexOf(C_AT_SIGN); + + if (position === -1 || position === length - 1) { + return; + } + + content = content.substr(MAILTO_PROTOCOL.length); + } + + /* istanbul ignore if - never used (yet) */ + if (silent) { + return true; + } + + exit = self.enterLink(); + content = self.tokenizeInline(content, eat.now()); + exit(); + + return eat(subvalue)({ + type: 'link', + title: null, + url: decode(subvalue, {nonTerminated: false}), + children: content + }); +} diff --git a/node_modules/remark-parse/lib/tokenizer.js b/node_modules/remark-parse/lib/tokenizer.js new file mode 100644 index 00000000..498ef22a --- /dev/null +++ b/node_modules/remark-parse/lib/tokenizer.js @@ -0,0 +1,331 @@ +'use strict'; + +module.exports = factory; + +var MERGEABLE_NODES = { + text: mergeText, + blockquote: mergeBlockquote +}; + +/* Check whether a node is mergeable with adjacent nodes. */ +function mergeable(node) { + var start; + var end; + + if (node.type !== 'text' || !node.position) { + return true; + } + + start = node.position.start; + end = node.position.end; + + /* Only merge nodes which occupy the same size as their + * `value`. */ + return start.line !== end.line || + end.column - start.column === node.value.length; +} + +/* Merge two text nodes: `node` into `prev`. */ +function mergeText(prev, node) { + prev.value += node.value; + + return prev; +} + +/* Merge two blockquotes: `node` into `prev`, unless in + * CommonMark mode. */ +function mergeBlockquote(prev, node) { + if (this.options.commonmark) { + return node; + } + + prev.children = prev.children.concat(node.children); + + return prev; +} + +/* Construct a tokenizer. This creates both + * `tokenizeInline` and `tokenizeBlock`. */ +function factory(type) { + return tokenize; + + /* Tokenizer for a bound `type`. */ + function tokenize(value, location) { + var self = this; + var offset = self.offset; + var tokens = []; + var methods = self[type + 'Methods']; + var tokenizers = self[type + 'Tokenizers']; + var line = location.line; + var column = location.column; + var index; + var length; + var method; + var name; + var matched; + var valueLength; + + /* Trim white space only lines. */ + if (!value) { + return tokens; + } + + /* Expose on `eat`. */ + eat.now = now; + eat.file = self.file; + + /* Sync initial offset. */ + updatePosition(''); + + /* Iterate over `value`, and iterate over all + * tokenizers. When one eats something, re-iterate + * with the remaining value. If no tokenizer eats, + * something failed (should not happen) and an + * exception is thrown. */ + while (value) { + index = -1; + length = methods.length; + matched = false; + + while (++index < length) { + name = methods[index]; + method = tokenizers[name]; + + if ( + method && + /* istanbul ignore next */ (!method.onlyAtStart || self.atStart) && + (!method.notInList || !self.inList) && + (!method.notInBlock || !self.inBlock) && + (!method.notInLink || !self.inLink) + ) { + valueLength = value.length; + + method.apply(self, [eat, value]); + + matched = valueLength !== value.length; + + if (matched) { + break; + } + } + } + + /* istanbul ignore if */ + if (!matched) { + self.file.fail(new Error('Infinite loop'), eat.now()); + } + } + + self.eof = now(); + + return tokens; + + /* Update line, column, and offset based on + * `value`. */ + function updatePosition(subvalue) { + var lastIndex = -1; + var index = subvalue.indexOf('\n'); + + while (index !== -1) { + line++; + lastIndex = index; + index = subvalue.indexOf('\n', index + 1); + } + + if (lastIndex === -1) { + column += subvalue.length; + } else { + column = subvalue.length - lastIndex; + } + + if (line in offset) { + if (lastIndex !== -1) { + column += offset[line]; + } else if (column <= offset[line]) { + column = offset[line] + 1; + } + } + } + + /* Get offset. Called before the first character is + * eaten to retrieve the range's offsets. */ + function getOffset() { + var indentation = []; + var pos = line + 1; + + /* Done. Called when the last character is + * eaten to retrieve the range’s offsets. */ + return function () { + var last = line + 1; + + while (pos < last) { + indentation.push((offset[pos] || 0) + 1); + + pos++; + } + + return indentation; + }; + } + + /* Get the current position. */ + function now() { + var pos = {line: line, column: column}; + + pos.offset = self.toOffset(pos); + + return pos; + } + + /* Store position information for a node. */ + function Position(start) { + this.start = start; + this.end = now(); + } + + /* Throw when a value is incorrectly eaten. + * This shouldn’t happen but will throw on new, + * incorrect rules. */ + function validateEat(subvalue) { + /* istanbul ignore if */ + if (value.substring(0, subvalue.length) !== subvalue) { + /* Capture stack-trace. */ + self.file.fail( + new Error( + 'Incorrectly eaten value: please report this ' + + 'warning on http://git.io/vg5Ft' + ), + now() + ); + } + } + + /* Mark position and patch `node.position`. */ + function position() { + var before = now(); + + return update; + + /* Add the position to a node. */ + function update(node, indent) { + var prev = node.position; + var start = prev ? prev.start : before; + var combined = []; + var n = prev && prev.end.line; + var l = before.line; + + node.position = new Position(start); + + /* If there was already a `position`, this + * node was merged. Fixing `start` wasn’t + * hard, but the indent is different. + * Especially because some information, the + * indent between `n` and `l` wasn’t + * tracked. Luckily, that space is + * (should be?) empty, so we can safely + * check for it now. */ + if (prev && indent && prev.indent) { + combined = prev.indent; + + if (n < l) { + while (++n < l) { + combined.push((offset[n] || 0) + 1); + } + + combined.push(before.column); + } + + indent = combined.concat(indent); + } + + node.position.indent = indent || []; + + return node; + } + } + + /* Add `node` to `parent`s children or to `tokens`. + * Performs merges where possible. */ + function add(node, parent) { + var children = parent ? parent.children : tokens; + var prev = children[children.length - 1]; + + if ( + prev && + node.type === prev.type && + node.type in MERGEABLE_NODES && + mergeable(prev) && + mergeable(node) + ) { + node = MERGEABLE_NODES[node.type].call(self, prev, node); + } + + if (node !== prev) { + children.push(node); + } + + if (self.atStart && tokens.length !== 0) { + self.exitStart(); + } + + return node; + } + + /* Remove `subvalue` from `value`. + * `subvalue` must be at the start of `value`. */ + function eat(subvalue) { + var indent = getOffset(); + var pos = position(); + var current = now(); + + validateEat(subvalue); + + apply.reset = reset; + reset.test = test; + apply.test = test; + + value = value.substring(subvalue.length); + + updatePosition(subvalue); + + indent = indent(); + + return apply; + + /* Add the given arguments, add `position` to + * the returned node, and return the node. */ + function apply(node, parent) { + return pos(add(pos(node), parent), indent); + } + + /* Functions just like apply, but resets the + * content: the line and column are reversed, + * and the eaten value is re-added. + * This is useful for nodes with a single + * type of content, such as lists and tables. + * See `apply` above for what parameters are + * expected. */ + function reset() { + var node = apply.apply(null, arguments); + + line = current.line; + column = current.column; + value = subvalue + value; + + return node; + } + + /* Test the position, after eating, and reverse + * to a not-eaten state. */ + function test() { + var result = pos({}); + + line = current.line; + column = current.column; + value = subvalue + value; + + return result.position; + } + } + } +} diff --git a/node_modules/remark-parse/lib/unescape.js b/node_modules/remark-parse/lib/unescape.js new file mode 100644 index 00000000..321900e7 --- /dev/null +++ b/node_modules/remark-parse/lib/unescape.js @@ -0,0 +1,37 @@ +'use strict'; + +module.exports = factory; + +/* Factory to de-escape a value, based on a list at `key` + * in `ctx`. */ +function factory(ctx, key) { + return unescape; + + /* De-escape a string using the expression at `key` + * in `ctx`. */ + function unescape(value) { + var prev = 0; + var index = value.indexOf('\\'); + var escape = ctx[key]; + var queue = []; + var character; + + while (index !== -1) { + queue.push(value.slice(prev, index)); + prev = index + 1; + character = value.charAt(prev); + + /* If the following character is not a valid escape, + * add the slash. */ + if (!character || escape.indexOf(character) === -1) { + queue.push('\\'); + } + + index = value.indexOf('\\', prev); + } + + queue.push(value.slice(prev)); + + return queue.join(''); + } +} diff --git a/node_modules/remark-parse/lib/util/get-indentation.js b/node_modules/remark-parse/lib/util/get-indentation.js new file mode 100644 index 00000000..3e09e141 --- /dev/null +++ b/node_modules/remark-parse/lib/util/get-indentation.js @@ -0,0 +1,32 @@ +'use strict'; + +module.exports = indentation; + +/* Map of characters, and their column length, + * which can be used as indentation. */ +var characters = {' ': 1, '\t': 4}; + +/* Gets indentation information for a line. */ +function indentation(value) { + var index = 0; + var indent = 0; + var character = value.charAt(index); + var stops = {}; + var size; + + while (character in characters) { + size = characters[character]; + + indent += size; + + if (size > 1) { + indent = Math.floor(indent / size) * size; + } + + stops[indent] = index; + + character = value.charAt(++index); + } + + return {indent: indent, stops: stops}; +} diff --git a/node_modules/remark-parse/lib/util/html.js b/node_modules/remark-parse/lib/util/html.js new file mode 100644 index 00000000..5f211f13 --- /dev/null +++ b/node_modules/remark-parse/lib/util/html.js @@ -0,0 +1,25 @@ +'use strict'; + +var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; +var unquoted = '[^"\'=<>`\\u0000-\\u0020]+'; +var singleQuoted = '\'[^\']*\''; +var doubleQuoted = '"[^"]*"'; +var attributeValue = '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')'; +var attribute = '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)'; +var openTag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'; +var closeTag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'; +var comment = '|'; +var processing = '<[?].*?[?]>'; +var declaration = ']*>'; +var cdata = ''; + +exports.openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')'); + +exports.tag = new RegExp('^(?:' + + openTag + '|' + + closeTag + '|' + + comment + '|' + + processing + '|' + + declaration + '|' + + cdata + +')'); diff --git a/node_modules/remark-parse/lib/util/interrupt.js b/node_modules/remark-parse/lib/util/interrupt.js new file mode 100644 index 00000000..e3178ab4 --- /dev/null +++ b/node_modules/remark-parse/lib/util/interrupt.js @@ -0,0 +1,43 @@ +'use strict'; + +module.exports = interrupt; + +function interrupt(interruptors, tokenizers, ctx, params) { + var bools = ['pedantic', 'commonmark']; + var count = bools.length; + var length = interruptors.length; + var index = -1; + var interruptor; + var config; + var fn; + var offset; + var bool; + var ignore; + + while (++index < length) { + interruptor = interruptors[index]; + config = interruptor[1] || {}; + fn = interruptor[0]; + offset = -1; + ignore = false; + + while (++offset < count) { + bool = bools[offset]; + + if (config[bool] !== undefined && config[bool] !== ctx.options[bool]) { + ignore = true; + break; + } + } + + if (ignore) { + continue; + } + + if (tokenizers[fn].apply(ctx, params)) { + return true; + } + } + + return false; +} diff --git a/node_modules/remark-parse/lib/util/normalize.js b/node_modules/remark-parse/lib/util/normalize.js new file mode 100644 index 00000000..846ceeec --- /dev/null +++ b/node_modules/remark-parse/lib/util/normalize.js @@ -0,0 +1,11 @@ +'use strict'; + +var collapseWhiteSpace = require('collapse-white-space'); + +module.exports = normalize; + +/* Normalize an identifier. Collapses multiple white space + * characters into a single space, and removes casing. */ +function normalize(value) { + return collapseWhiteSpace(value).toLowerCase(); +} diff --git a/node_modules/remark-parse/lib/util/remove-indentation.js b/node_modules/remark-parse/lib/util/remove-indentation.js new file mode 100644 index 00000000..20f18be7 --- /dev/null +++ b/node_modules/remark-parse/lib/util/remove-indentation.js @@ -0,0 +1,78 @@ +'use strict'; + +var trim = require('trim'); +var repeat = require('repeat-string'); +var getIndent = require('./get-indentation'); + +module.exports = indentation; + +var C_SPACE = ' '; +var C_NEWLINE = '\n'; +var C_TAB = '\t'; + +/* Remove the minimum indent from every line in `value`. + * Supports both tab, spaced, and mixed indentation (as + * well as possible). */ +function indentation(value, maximum) { + var values = value.split(C_NEWLINE); + var position = values.length + 1; + var minIndent = Infinity; + var matrix = []; + var index; + var indentation; + var stops; + var padding; + + values.unshift(repeat(C_SPACE, maximum) + '!'); + + while (position--) { + indentation = getIndent(values[position]); + + matrix[position] = indentation.stops; + + if (trim(values[position]).length === 0) { + continue; + } + + if (indentation.indent) { + if (indentation.indent > 0 && indentation.indent < minIndent) { + minIndent = indentation.indent; + } + } else { + minIndent = Infinity; + + break; + } + } + + if (minIndent !== Infinity) { + position = values.length; + + while (position--) { + stops = matrix[position]; + index = minIndent; + + while (index && !(index in stops)) { + index--; + } + + if ( + trim(values[position]).length !== 0 && + minIndent && + index !== minIndent + ) { + padding = C_TAB; + } else { + padding = ''; + } + + values[position] = padding + values[position].slice( + index in stops ? stops[index] + 1 : 0 + ); + } + } + + values.shift(); + + return values.join(C_NEWLINE); +} diff --git a/node_modules/remark-parse/package.json b/node_modules/remark-parse/package.json new file mode 100644 index 00000000..a9fbf8f0 --- /dev/null +++ b/node_modules/remark-parse/package.json @@ -0,0 +1,85 @@ +{ + "_from": "remark-parse@^5.0.0", + "_id": "remark-parse@5.0.0", + "_inBundle": false, + "_integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==", + "_location": "/remark-parse", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-parse@^5.0.0", + "name": "remark-parse", + "escapedName": "remark-parse", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/remark" + ], + "_resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz", + "_shasum": "4c077f9e499044d1d5c13f80d7a98cf7b9285d95", + "_spec": "remark-parse@^5.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + } + ], + "dependencies": { + "collapse-white-space": "^1.0.2", + "is-alphabetical": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "is-word-character": "^1.0.0", + "markdown-escapes": "^1.0.0", + "parse-entities": "^1.1.0", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "trim": "0.0.1", + "trim-trailing-lines": "^1.0.0", + "unherit": "^1.0.4", + "unist-util-remove-position": "^1.0.0", + "vfile-location": "^2.0.0", + "xtend": "^4.0.1" + }, + "deprecated": false, + "description": "Markdown parser for remark", + "files": [ + "index.js", + "lib" + ], + "homepage": "http://remark.js.org", + "keywords": [ + "markdown", + "abstract", + "syntax", + "tree", + "ast", + "parse" + ], + "license": "MIT", + "name": "remark-parse", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark/tree/master/packages/remark-parse" + }, + "version": "5.0.0", + "xo": false +} diff --git a/node_modules/remark-parse/readme.md b/node_modules/remark-parse/readme.md new file mode 100644 index 00000000..ecaa6c09 --- /dev/null +++ b/node_modules/remark-parse/readme.md @@ -0,0 +1,453 @@ +# remark-parse [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] + +[Parser][] for [**unified**][unified]. Parses markdown to an +[**MDAST**][mdast] syntax tree. Used in the [**remark** +processor][processor]. Can be [extended][extend] to change how +markdown is parsed. + +## Installation + +[npm][]: + +```sh +npm install remark-parse +``` + +## Usage + +```js +var unified = require('unified'); +var createStream = require('unified-stream'); +var markdown = require('remark-parse'); +var html = require('remark-html'); + +var processor = unified() + .use(markdown, {commonmark: true}) + .use(html) + +process.stdin + .pipe(createStream(processor)) + .pipe(process.stdout); +``` + +## Table of Contents + +* [API](#api) + * [processor.use(parse\[, options\])](#processoruseparse-options) + * [parse.Parser](#parseparser) +* [Extending the Parser](#extending-the-parser) + * [Parser#blockTokenizers](#parserblocktokenizers) + * [Parser#blockMethods](#parserblockmethods) + * [Parser#inlineTokenizers](#parserinlinetokenizers) + * [Parser#inlineMethods](#parserinlinemethods) + * [function tokenizer(eat, value, silent)](#function-tokenizereat-value-silent) + * [tokenizer.locator(value, fromIndex)](#tokenizerlocatorvalue-fromindex) + * [eat(subvalue)](#eatsubvalue) + * [add(node\[, parent\])](#addnode-parent) + * [add.test()](#addtest) + * [add.reset(node\[, parent\])](#addresetnode-parent) + * [Turning off a tokenizer](#turning-off-a-tokenizer) +* [License](#license) + +## API + +### `processor.use(parse[, options])` + +Configure the `processor` to read markdown as input and process an +[**MDAST**][mdast] syntax tree. + +##### `options` + +Options are passed directly, or passed later through [`processor.data()`][data]. + +##### `options.gfm` + +```md +hello ~~hi~~ world +``` + +GFM mode (`boolean`, default: `true`) turns on: + +* [Fenced code blocks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) +* [Autolinking of URLs](https://help.github.com/articles/github-flavored-markdown/#url-autolinking) +* [Deletions (strikethrough)](https://help.github.com/articles/github-flavored-markdown/#strikethrough) +* [Task lists](https://help.github.com/articles/writing-on-github/#task-lists) +* [Tables](https://help.github.com/articles/github-flavored-markdown/#tables) + +##### `options.commonmark` + +```md +This is a paragraph + and this is also part of the preceding paragraph. +``` + +CommonMark mode (`boolean`, default: `false`) allows: + +* Empty lines to split blockquotes +* Parentheses (`(` and `)`) around for link and image titles +* Any escaped [ASCII-punctuation][escapes] character +* Closing parenthesis (`)`) as an ordered list marker +* URL definitions (and footnotes, when enabled) in blockquotes + +CommonMark mode disallows: + +* Code directly following a paragraph +* ATX-headings (`# Hash headings`) without spacing after opening hashes + or and before closing hashes +* Setext headings (`Underline headings\n---`) when following a paragraph +* Newlines in link and image titles +* White space in link and image URLs in auto-links (links in brackets, + `<` and `>`) +* Lazy blockquote continuation, lines not preceded by a closing angle + bracket (`>`), for lists, code, and thematicBreak + +##### `options.footnotes` + +```md +Something something[^or something?]. + +And something else[^1]. + +[^1]: This reference footnote contains a paragraph... + + * ...and a list +``` + +Footnotes mode (`boolean`, default: `false`) enables reference footnotes and +inline footnotes. Both are wrapped in square brackets and preceded by a caret +(`^`), and can be referenced from inside other footnotes. + +##### `options.blocks` + +```md +foo + +``` + +Blocks (`Array.`, default: list of [block HTML elements][blocks]) +exposes let’s users define block-level HTML elements. + +##### `options.pedantic` + +```md +Check out some_file_name.txt +``` + +Pedantic mode (`boolean`, default: `false`) turns on: + +* Emphasis (`_alpha_`) and importance (`__bravo__`) with underscores + in words +* Unordered lists with different markers (`*`, `-`, `+`) +* If `commonmark` is also turned on, ordered lists with different + markers (`.`, `)`) +* And pedantic mode removes less spaces in list-items (at most four, + instead of the whole indent) + +### `parse.Parser` + +Access to the [parser][], if you need it. + +## Extending the Parser + +Most often, using transformers to manipulate a syntax tree produces +the desired output. Sometimes, mainly when introducing new syntactic +entities with a certain level of precedence, interfacing with the parser +is necessary. + +If the `remark-parse` plugin is used, it adds a [`Parser`][parser] constructor +to the `processor`. Other plugins can add tokenizers to the parser’s prototype +to change how markdown is parsed. + +The below plugin adds a [tokenizer][] for at-mentions. + +```js +module.exports = mentions; + +function mentions() { + var Parser = this.Parser; + var tokenizers = Parser.prototype.inlineTokenizers; + var methods = Parser.prototype.inlineMethods; + + /* Add an inline tokenizer (defined in the following example). */ + tokenizers.mention = tokenizeMention; + + /* Run it just before `text`. */ + methods.splice(methods.indexOf('text'), 0, 'mention'); +} +``` + +### `Parser#blockTokenizers` + +An object mapping tokenizer names to [tokenizer][]s. These +tokenizers (for example: `fencedCode`, `table`, and `paragraph`) eat +from the start of a value to a line ending. + +See `#blockMethods` below for a list of methods that are included by +default. + +### `Parser#blockMethods` + +Array of `blockTokenizers` names (`string`) specifying the order in +which they run. + + + +* `newline` +* `indentedCode` +* `fencedCode` +* `blockquote` +* `atxHeading` +* `thematicBreak` +* `list` +* `setextHeading` +* `html` +* `footnote` +* `definition` +* `table` +* `paragraph` + + + +### `Parser#inlineTokenizers` + +An object mapping tokenizer names to [tokenizer][]s. These tokenizers +(for example: `url`, `reference`, and `emphasis`) eat from the start +of a value. To increase performance, they depend on [locator][]s. + +See `#inlineMethods` below for a list of methods that are included by +default. + +### `Parser#inlineMethods` + +Array of `inlineTokenizers` names (`string`) specifying the order in +which they run. + + + +* `escape` +* `autoLink` +* `url` +* `html` +* `link` +* `reference` +* `strong` +* `emphasis` +* `deletion` +* `code` +* `break` +* `text` + + + +### `function tokenizer(eat, value, silent)` + +```js +tokenizeMention.notInLink = true; +tokenizeMention.locator = locateMention; + +function tokenizeMention(eat, value, silent) { + var match = /^@(\w+)/.exec(value); + + if (match) { + if (silent) { + return true; + } + + return eat(match[0])({ + type: 'link', + url: 'https://social-network/' + match[1], + children: [{type: 'text', value: match[0]}] + }); + } +} +``` + +The parser knows two types of tokenizers: block level and inline level. +Block level tokenizers are the same as inline level tokenizers, with +the exception that the latter must have a [locator][]. + +Tokenizers _test_ whether a document starts with a certain syntactic +entity. In _silent_ mode, they return whether that test passes. +In _normal_ mode, they consume that token, a process which is called +“eating”. Locators enable tokenizers to function faster by providing +information on where the next entity may occur. + +###### Signatures + +* `Node? = tokenizer(eat, value)` +* `boolean? = tokenizer(eat, value, silent)` + +###### Parameters + +* `eat` ([`Function`][eat]) — Eat, when applicable, an entity +* `value` (`string`) — Value which may start an entity +* `silent` (`boolean`, optional) — Whether to detect or consume + +###### Properties + +* `locator` ([`Function`][locator]) + — Required for inline tokenizers +* `onlyAtStart` (`boolean`) + — Whether nodes can only be found at the beginning of the document +* `notInBlock` (`boolean`) + — Whether nodes cannot be in blockquotes, lists, or footnote + definitions +* `notInList` (`boolean`) + — Whether nodes cannot be in lists +* `notInLink` (`boolean`) + — Whether nodes cannot be in links + +###### Returns + +* In _silent_ mode, whether a node can be found at the start of `value` +* In _normal_ mode, a node if it can be found at the start of `value` + +### `tokenizer.locator(value, fromIndex)` + +```js +function locateMention(value, fromIndex) { + return value.indexOf('@', fromIndex); +} +``` + +Locators are required for inline tokenization to keep the process +performant. Locators enable inline tokenizers to function faster by +providing information on the where the next entity occurs. Locators +may be wrong, it’s OK if there actually isn’t a node to be found at +the index they return, but they must skip any nodes. + +###### Parameters + +* `value` (`string`) — Value which may contain an entity +* `fromIndex` (`number`) — Position to start searching at + +###### Returns + +Index at which an entity may start, and `-1` otherwise. + +### `eat(subvalue)` + +```js +var add = eat('foo'); +``` + +Eat `subvalue`, which is a string at the start of the +[tokenize][tokenizer]d `value` (it’s tracked to ensure the correct +value is eaten). + +###### Parameters + +* `subvalue` (`string`) - Value to eat. + +###### Returns + +[`add`][add]. + +### `add(node[, parent])` + +```js +var add = eat('foo'); +add({type: 'text', value: 'foo'}); +``` + +Add [positional information][location] to `node` and add it to `parent`. + +###### Parameters + +* `node` ([`Node`][node]) - Node to patch position on and insert +* `parent` ([`Node`][node], optional) - Place to add `node` to in + the syntax tree. Defaults to the currently processed node + +###### Returns + +The given `node`. + +### `add.test()` + +Get the [positional information][location] which would be patched on +`node` by `add`. + +###### Returns + +[`Location`][location]. + +### `add.reset(node[, parent])` + +`add`, but resets the internal location. Useful for example in +lists, where the same content is first eaten for a list, and later +for list items + +###### Parameters + +* `node` ([`Node`][node]) - Node to patch position on and insert +* `parent` ([`Node`][node], optional) - Place to add `node` to in + the syntax tree. Defaults to the currently processed node + +###### Returns + +The given `node`. + +### Turning off a tokenizer + +In rare situations, you may want to turn off a tokenizer to avoid parsing +that syntactic feature. This can be done by deleting the tokenizer from +your Parser’s `blockTokenizers` (or `blockMethods`) or `inlineTokenizers` +(or `inlineMethods`). + +The following example turns off indented code blocks: + +```js +delete remarkParse.Parser.prototype.blockTokenizers.indentedCode; +``` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/remarkjs/remark.svg + +[build-status]: https://travis-ci.org/remarkjs/remark + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg + +[coverage-status]: https://codecov.io/github/remarkjs/remark + +[chat-badge]: https://img.shields.io/gitter/room/remarkjs/Lobby.svg + +[chat]: https://gitter.im/remarkjs/Lobby + +[license]: https://github.com/remarkjs/remark/blob/master/LICENSE + +[author]: http://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[unified]: https://github.com/unifiedjs/unified + +[data]: https://github.com/unifiedjs/unified#processordatakey-value + +[processor]: https://github.com/unifiedjs/remark/blob/master/packages/remark + +[mdast]: https://github.com/syntax-tree/mdast + +[escapes]: http://spec.commonmark.org/0.25/#backslash-escapes + +[node]: https://github.com/syntax-tree/unist#node + +[location]: https://github.com/syntax-tree/unist#location + +[parser]: https://github.com/unifiedjs/unified#processorparser + +[extend]: #extending-the-parser + +[tokenizer]: #function-tokenizereat-value-silent + +[locator]: #tokenizerlocatorvalue-fromindex + +[eat]: #eatsubvalue + +[add]: #addnode-parent + +[blocks]: https://github.com/remarkjs/remark/blob/master/packages/remark-parse/lib/block-elements.json diff --git a/node_modules/remark-preset-lint-consistent/index.js b/node_modules/remark-preset-lint-consistent/index.js new file mode 100644 index 00000000..94e913f3 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/index.js @@ -0,0 +1,23 @@ +/** + * @fileoverview + * remark preset to configure `remark-lint` with settings that enforce + * consistency. + */ + +'use strict' + +module.exports.plugins = [ + require('remark-lint'), + [require('remark-lint-blockquote-indentation'), 'consistent'], + [require('remark-lint-checkbox-character-style'), 'consistent'], + [require('remark-lint-code-block-style'), 'consistent'], + [require('remark-lint-emphasis-marker'), 'consistent'], + [require('remark-lint-fenced-code-marker'), 'consistent'], + [require('remark-lint-heading-style'), 'consistent'], + [require('remark-lint-link-title-style'), 'consistent'], + require('remark-lint-list-item-content-indent'), + [require('remark-lint-ordered-list-marker-style'), 'consistent'], + [require('remark-lint-rule-style'), 'consistent'], + [require('remark-lint-strong-marker'), 'consistent'], + [require('remark-lint-table-cell-padding'), 'consistent'] +] diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/index.js b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/index.js new file mode 100644 index 00000000..9d9e7797 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/index.js @@ -0,0 +1,161 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module checkbox-character-style + * @fileoverview + * Warn when list item checkboxes violate a given style. + * + * Options: `Object` or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used checked and unchecked checkbox + * styles and warns when subsequent checkboxes use different styles. + * + * Styles can also be passed in like so: + * + * ```js + * {checked: 'x', unchecked: ' '} + * ``` + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats checked checkboxes using `x` (lowercase X) and unchecked checkboxes + * as `·` (a single space). + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": {"checked": "x"}, "gfm": true} + * + * - [x] List item + * - [x] List item + * + * @example {"name": "ok.md", "setting": {"checked": "X"}, "gfm": true} + * + * - [X] List item + * - [X] List item + * + * @example {"name": "ok.md", "setting": {"unchecked": " "}, "gfm": true} + * + * - [ ] List item + * - [ ] List item + * - [ ]·· + * - [ ] + * + * @example {"name": "ok.md", "setting": {"unchecked": "\t"}, "gfm": true} + * + * - [»] List item + * - [»] List item + * + * @example {"name": "not-ok.md", "label": "input", "gfm": true} + * + * - [x] List item + * - [X] List item + * - [ ] List item + * - [»] List item + * + * @example {"name": "not-ok.md", "label": "output", "gfm": true} + * + * 2:5: Checked checkboxes should use `x` as a marker + * 4:5: Unchecked checkboxes should use ` ` as a marker + * + * @example {"setting": {"unchecked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true} + * + * 1:1: Incorrect unchecked checkbox marker `💩`: use either `'\t'`, or `' '` + * + * @example {"setting": {"checked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true} + * + * 1:1: Incorrect checked checkbox marker `💩`: use either `'x'`, or `'X'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:checkbox-character-style', + checkboxCharacterStyle +) + +var start = position.start +var end = position.end + +var checked = {x: true, X: true} +var unchecked = {' ': true, '\t': true} +var types = {true: 'checked', false: 'unchecked'} + +function checkboxCharacterStyle(tree, file, option) { + var contents = String(file) + var preferred = typeof option === 'object' ? option : {} + + if (preferred.unchecked && unchecked[preferred.unchecked] !== true) { + file.fail( + 'Incorrect unchecked checkbox marker `' + + preferred.unchecked + + "`: use either `'\\t'`, or `' '`" + ) + } + + if (preferred.checked && checked[preferred.checked] !== true) { + file.fail( + 'Incorrect checked checkbox marker `' + + preferred.checked + + "`: use either `'x'`, or `'X'`" + ) + } + + visit(tree, 'listItem', visitor) + + function visitor(node) { + var type + var point + var value + var style + var reason + + // Exit early for items without checkbox. + if (typeof node.checked !== 'boolean' || generated(node)) { + return + } + + type = types[node.checked] + + /* istanbul ignore next - a list item cannot be checked and empty, according + * to GFM, but theoretically it makes sense to get the end if that were + * possible. */ + point = node.children.length === 0 ? end(node) : start(node.children[0]) + // Move back to before `] `. + point.offset -= 2 + point.column -= 2 + + // Assume we start with a checkbox, because well, `checked` is set. + value = /\[([\t Xx])]/.exec( + contents.slice(point.offset - 2, point.offset + 1) + ) + + /* istanbul ignore if - failsafe to make sure we don‘t crash if there + * actually isn’t a checkbox. */ + if (!value) return + + style = preferred[type] + + if (style) { + if (value[1] !== style) { + reason = + type.charAt(0).toUpperCase() + + type.slice(1) + + ' checkboxes should use `' + + style + + '` as a marker' + + file.message(reason, point) + } + } else { + preferred[type] = value[1] + } + } +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/package.json b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/package.json new file mode 100644 index 00000000..c1062431 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-checkbox-character-style@^3.0.0", + "_id": "remark-lint-checkbox-character-style@3.0.0", + "_inBundle": false, + "_integrity": "sha512-691OJ5RdBRXVpvnOEiBhMB4uhHJSHVttw83O4qyAkNBiqxa1Axqhsz8FgmzYgRLQbOGd2ncVUcXG1LOJt6C0DQ==", + "_location": "/remark-preset-lint-consistent/remark-lint-checkbox-character-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-checkbox-character-style@^3.0.0", + "name": "remark-lint-checkbox-character-style", + "escapedName": "remark-lint-checkbox-character-style", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-3.0.0.tgz", + "_shasum": "3a982c7318ea86f80fe5ee5d6d8711b5b3cad0a2", + "_spec": "remark-lint-checkbox-character-style@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when list item checkboxes violate a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "checkbox", + "style", + "task", + "list" + ], + "license": "MIT", + "name": "remark-lint-checkbox-character-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-checkbox-character-style" + }, + "version": "3.0.0", + "xo": false +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/readme.md new file mode 100644 index 00000000..007aadc5 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-checkbox-character-style/readme.md @@ -0,0 +1,260 @@ + + +# remark-lint-checkbox-character-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when list item checkboxes violate a given style. + +Options: `Object` or `'consistent'`, default: `'consistent'`. + +`'consistent'` detects the first used checked and unchecked checkbox +styles and warns when subsequent checkboxes use different styles. + +Styles can also be passed in like so: + +```js +{checked: 'x', unchecked: ' '} +``` + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats checked checkboxes using `x` (lowercase X) and unchecked checkboxes +as `·` (a single space). + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | + +## Example + +##### `ok.md` + +When configured with `{ checked: 'x' }`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +- [x] List item +- [x] List item +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `{ checked: 'X' }`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +- [X] List item +- [X] List item +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `{ unchecked: ' ' }`. + +###### In + +Note: this example uses [GFM][]. + +Note: `·` represents a space. + +```markdown +- [ ] List item +- [ ] List item +- [ ]·· +- [ ] +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `{ unchecked: '\t' }`. + +###### In + +Note: this example uses [GFM][]. + +Note: `»` represents a tab. + +```markdown +- [»] List item +- [»] List item +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: this example uses [GFM][]. + +Note: `»` represents a tab. + +```markdown +- [x] List item +- [X] List item +- [ ] List item +- [»] List item +``` + +###### Out + +```text +2:5: Checked checkboxes should use `x` as a marker +4:5: Unchecked checkboxes should use ` ` as a marker +``` + +##### `not-ok.md` + +When configured with `{ unchecked: '💩' }`. + +###### Out + +```text +1:1: Incorrect unchecked checkbox marker `💩`: use either `'\t'`, or `' '` +``` + +##### `not-ok.md` + +When configured with `{ checked: '💩' }`. + +###### Out + +```text +1:1: Incorrect checked checkbox marker `💩`: use either `'x'`, or `'X'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-checkbox-character-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-checkbox-character-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-checkbox-character-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-checkbox-character-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-checkbox-character-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-checkbox-character-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-checkbox-character-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-checkbox-character-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/remarkjs/remark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com + +[gfm]: https://github.com/remarkjs/remark-gfm diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/index.js b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/index.js new file mode 100644 index 00000000..f1dc83d7 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/index.js @@ -0,0 +1,304 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module table-cell-padding + * @fileoverview + * Warn when table cells are incorrectly padded. + * + * Options: `'consistent'`, `'padded'`, or `'compact'`, default: `'consistent'`. + * + * `'consistent'` detects the first used cell padding style and warns when + * subsequent cells use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) + * formats tables with padding by default. + * Pass + * [`spacedTable: false`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsspacedtable) + * to not use padding. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "padded", "gfm": true} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input", "setting": "padded", "gfm": true} + * + * | A | B | + * | :----|----: | + * | Alpha|Bravo | + * + * | C | D | + * | :----- | ---: | + * |Charlie | Delta| + * + * Too much padding isn’t good either: + * + * | E | F | G | H | + * | :---- | -------- | :----: | -----: | + * | Echo | Foxtrot | Golf | Hotel | + * + * @example {"name": "not-ok.md", "label": "output", "setting": "padded", "gfm": true} + * + * 3:8: Cell should be padded + * 3:9: Cell should be padded + * 7:2: Cell should be padded + * 7:17: Cell should be padded + * 13:9: Cell should be padded with 1 space, not 2 + * 13:20: Cell should be padded with 1 space, not 2 + * 13:21: Cell should be padded with 1 space, not 2 + * 13:29: Cell should be padded with 1 space, not 2 + * 13:30: Cell should be padded with 1 space, not 2 + * + * @example {"name": "ok.md", "setting": "compact", "gfm": true} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * @example {"name": "not-ok.md", "label": "input", "setting": "compact", "gfm": true} + * + * | A | B | + * | -----| -----| + * | Alpha| Bravo| + * + * |C | D| + * |:------|-----:| + * |Charlie|Delta | + * + * @example {"name": "not-ok.md", "label": "output", "setting": "compact", "gfm": true} + * + * 3:2: Cell should be compact + * 3:11: Cell should be compact + * 7:16: Cell should be compact + * + * @example {"name": "ok-padded.md", "setting": "consistent", "gfm": true} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * | C | D | + * | ------- | ----- | + * | Charlie | Delta | + * + * @example {"name": "not-ok-padded.md", "label": "input", "setting": "consistent", "gfm": true} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * | C | D | + * | :----- | ----: | + * |Charlie | Delta | + * + * @example {"name": "not-ok-padded.md", "label": "output", "setting": "consistent", "gfm": true} + * + * 7:2: Cell should be padded + * + * @example {"name": "ok-compact.md", "setting": "consistent", "gfm": true} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * |C |D | + * |-------|-----| + * |Charlie|Delta| + * + * @example {"name": "not-ok-compact.md", "label": "input", "setting": "consistent", "gfm": true} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * |C | D| + * |:------|-----:| + * |Charlie|Delta | + * + * @example {"name": "not-ok-compact.md", "label": "output", "setting": "consistent", "gfm": true} + * + * 7:16: Cell should be compact + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true, "gfm": true} + * + * 1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'` + * + * @example {"name": "empty.md", "label": "input", "setting": "padded", "gfm": true} + * + * + * + * | | Alpha | Bravo| + * | ------ | ----- | ---: | + * | Charlie| | Echo| + * + * @example {"name": "empty.md", "label": "output", "setting": "padded", "gfm": true} + * + * 3:25: Cell should be padded + * 5:10: Cell should be padded + * 5:25: Cell should be padded + * + * @example {"name": "missing-body.md", "setting": "padded", "gfm": true} + * + * + * + * | Alpha | Bravo | Charlie | + * | ----- | ------- | ------- | + * | Delta | + * | Echo | Foxtrot | + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:table-cell-padding', tableCellPadding) + +var start = position.start +var end = position.end + +var styles = {null: true, padded: true, compact: true} + +function tableCellPadding(tree, file, option) { + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect table cell padding style `' + + preferred + + "`, expected `'padded'`, `'compact'`, or `'consistent'`" + ) + } + + visit(tree, 'table', visitor) + + function visitor(node) { + var rows = node.children + var sizes = new Array(node.align.length) + var length = generated(node) ? -1 : rows.length + var index = -1 + var entries = [] + var style + var row + var cells + var column + var cellCount + var cell + var entry + var contentStart + var contentEnd + + // Check rows. + while (++index < length) { + row = rows[index] + cells = row.children + cellCount = cells.length + column = -1 + + // Check fences (before, between, and after cells). + while (++column < cellCount) { + cell = cells[column] + + if (cell && cell.children.length !== 0) { + contentStart = start(cell.children[0]).offset + contentEnd = end(cell.children[cell.children.length - 1]).offset + + entries.push({ + node: cell, + start: contentStart - start(cell).offset - (column ? 0 : 1), + end: end(cell).offset - contentEnd - 1, + column: column + }) + + // Detect max space per column. + sizes[column] = Math.max( + sizes[column] || 0, + contentEnd - contentStart + ) + } + } + } + + if (preferred) { + style = preferred === 'padded' ? 1 : 0 + } else { + style = entries[0] && (!entries[0].start || !entries[0].end) ? 0 : 1 + } + + index = -1 + length = entries.length + + while (++index < length) { + entry = entries[index] + checkSide('start', entry, style, sizes) + checkSide('end', entry, style, sizes) + } + + return visit.SKIP + } + + function checkSide(side, entry, style, sizes) { + var cell = entry.node + var spacing = entry[side] + var column = entry.column + var reason + var point + + if (spacing === undefined || spacing === style) { + return + } + + reason = 'Cell should be ' + + if (style === 0) { + // Ignore every cell except the biggest in the column. + if (size(cell) < sizes[column]) { + return + } + + reason += 'compact' + } else { + reason += 'padded' + + if (spacing > style) { + // May be right or center aligned. + if (size(cell) < sizes[column]) { + return + } + + reason += ' with 1 space, not ' + spacing + } + } + + if (side === 'start') { + point = start(cell) + if (!column) { + point.column++ + point.offset++ + } + } else { + point = end(cell) + point.column-- + point.offset-- + } + + file.message(reason, point) + } +} + +function size(node) { + return ( + end(node.children[node.children.length - 1]).offset - + start(node.children[0]).offset + ) +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/package.json b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/package.json new file mode 100644 index 00000000..b80d660c --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-table-cell-padding@^3.0.0", + "_id": "remark-lint-table-cell-padding@3.0.0", + "_inBundle": false, + "_integrity": "sha512-sEKrbyFZPZpxI39R8/r+CwUrin9YtyRwVn0SQkNQEZWZcIpylK+bvoKIldvLIXQPob+ZxklL0GPVRzotQMwuWQ==", + "_location": "/remark-preset-lint-consistent/remark-lint-table-cell-padding", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-table-cell-padding@^3.0.0", + "name": "remark-lint-table-cell-padding", + "escapedName": "remark-lint-table-cell-padding", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-3.0.0.tgz", + "_shasum": "a769ba1999984ff5f90294fb6ccb8aead7e8a12f", + "_spec": "remark-lint-table-cell-padding@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^2.0.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when table cells are incorrectly padded", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "table", + "cell", + "padding" + ], + "license": "MIT", + "name": "remark-lint-table-cell-padding", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-table-cell-padding" + }, + "version": "3.0.0", + "xo": false +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/readme.md new file mode 100644 index 00000000..1b4f3601 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint-table-cell-padding/readme.md @@ -0,0 +1,388 @@ + + +# remark-lint-table-cell-padding + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when table cells are incorrectly padded. + +Options: `'consistent'`, `'padded'`, or `'compact'`, default: `'consistent'`. + +`'consistent'` detects the first used cell padding style and warns when +subsequent cells use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) +formats tables with padding by default. +Pass +[`spacedTable: false`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsspacedtable) +to not use padding. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| - | - | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'padded'` | + +## Example + +##### `ok.md` + +When configured with `'padded'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'padded'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +| A | B | +| :----|----: | +| Alpha|Bravo | + +| C | D | +| :----- | ---: | +|Charlie | Delta| + +Too much padding isn’t good either: + +| E | F | G | H | +| :---- | -------- | :----: | -----: | +| Echo | Foxtrot | Golf | Hotel | +``` + +###### Out + +```text +3:8: Cell should be padded +3:9: Cell should be padded +7:2: Cell should be padded +7:17: Cell should be padded +13:9: Cell should be padded with 1 space, not 2 +13:20: Cell should be padded with 1 space, not 2 +13:21: Cell should be padded with 1 space, not 2 +13:29: Cell should be padded with 1 space, not 2 +13:30: Cell should be padded with 1 space, not 2 +``` + +##### `empty.md` + +When configured with `'padded'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown + + +| | Alpha | Bravo| +| ------ | ----- | ---: | +| Charlie| | Echo| +``` + +###### Out + +```text +3:25: Cell should be padded +5:10: Cell should be padded +5:25: Cell should be padded +``` + +##### `missing-body.md` + +When configured with `'padded'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown + + +| Alpha | Bravo | Charlie | +| ----- | ------- | ------- | +| Delta | +| Echo | Foxtrot | +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'compact'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'compact'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +| A | B | +| -----| -----| +| Alpha| Bravo| + +|C | D| +|:------|-----:| +|Charlie|Delta | +``` + +###### Out + +```text +3:2: Cell should be compact +3:11: Cell should be compact +7:16: Cell should be compact +``` + +##### `ok-padded.md` + +When configured with `'consistent'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | + +| C | D | +| ------- | ----- | +| Charlie | Delta | +``` + +###### Out + +No messages. + +##### `not-ok-padded.md` + +When configured with `'consistent'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | + +| C | D | +| :----- | ----: | +|Charlie | Delta | +``` + +###### Out + +```text +7:2: Cell should be padded +``` + +##### `ok-compact.md` + +When configured with `'consistent'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| + +|C |D | +|-------|-----| +|Charlie|Delta| +``` + +###### Out + +No messages. + +##### `not-ok-compact.md` + +When configured with `'consistent'`. + +###### In + +Note: this example uses [GFM][]. + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| + +|C | D| +|:------|-----:| +|Charlie|Delta | +``` + +###### Out + +```text +7:16: Cell should be compact +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-table-cell-padding +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-table-cell-padding", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-table-cell-padding readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-table-cell-padding')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-table-cell-padding.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-table-cell-padding + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-table-cell-padding.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-table-cell-padding + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/remarkjs/remark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com + +[gfm]: https://github.com/remarkjs/remark-gfm diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/index.js b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/index.js new file mode 100644 index 00000000..2bd148a1 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/index.js @@ -0,0 +1,16 @@ +'use strict' + +var control = require('remark-message-control') + +module.exports = lint + +// `remark-lint`. +// This adds support for ignoring stuff from messages (``). +// All rules are in their own packages and presets. +function lint() { + this.use(lintMessageControl) +} + +function lintMessageControl() { + return control({name: 'lint', source: 'remark-lint'}) +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/package.json b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/package.json new file mode 100644 index 00000000..fa5c5aae --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/package.json @@ -0,0 +1,71 @@ +{ + "_from": "remark-lint@^8.0.0", + "_id": "remark-lint@8.0.0", + "_inBundle": false, + "_integrity": "sha512-ESI8qJQ/TIRjABDnqoFsTiZntu+FRifZ5fJ77yX63eIDijl/arvmDvT+tAf75/Nm5BFL4R2JFUtkHRGVjzYUsg==", + "_location": "/remark-preset-lint-consistent/remark-lint", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint@^8.0.0", + "name": "remark-lint", + "escapedName": "remark-lint", + "rawSpec": "^8.0.0", + "saveSpec": null, + "fetchSpec": "^8.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent" + ], + "_resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-8.0.0.tgz", + "_shasum": "6e40894f4a39eaea31fc4dd45abfaba948bf9a09", + "_spec": "remark-lint@^8.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "remark-message-control": "^6.0.0" + }, + "deprecated": false, + "description": "remark plugin to lint Markdown code style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "unified", + "remark", + "remark-plugin", + "plugin", + "mdast", + "markdown", + "lint", + "validate" + ], + "license": "MIT", + "name": "remark-lint", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint" + }, + "version": "8.0.0", + "xo": false +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/readme.md new file mode 100644 index 00000000..d6f9b597 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-lint/readme.md @@ -0,0 +1,126 @@ +# ![remark-lint][logo] + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**remark**][remark] plugin to lint Markdown code style. + +Read more about `remark-lint` on [the monorepo readme][readme]. + +This package doesn’t do much other than [suppressing messages][suppres] through +comments. + +If you’re using [presets][], they already include `remark-lint` itself. +If you’re using just plugins, you have to include `remark-lint` explicitly. + +## Install + +[npm][]: + +```sh +npm install remark-lint +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … ++ "lint", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() ++ .use(require('remark-lint')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }); +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[logo]: https://raw.githubusercontent.com/remarkjs/remark-lint/02295bc/logo.svg?sanitize=true + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint.svg + +[downloads]: https://www.npmjs.com/package/remark-lint + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint.svg + +[size]: https://bundlephobia.com/result?p=remark-lint + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/remarkjs/remark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com + +[remark]: https://github.com/remarkjs/remark + +[readme]: https://github.com/remarkjs/remark-lint#readme + +[suppres]: https://github.com/remarkjs/remark-lint#configuring-remark-lint + +[presets]: https://github.com/remarkjs/remark-lint#list-of-presets diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/index.js b/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/index.js new file mode 100644 index 00000000..79fe3be7 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/index.js @@ -0,0 +1,15 @@ +'use strict' + +var control = require('unified-message-control') +var marker = require('mdast-comment-marker') + +module.exports = messageControl + +var test = [ + 'html', // Comments are `html` nodes in mdast. + 'comment' // In MDX, comments have their own node. +] + +function messageControl(options) { + return control(Object.assign({marker: marker, test: test}, options)) +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/license b/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-preset-lint-consistent/node_modules/remark-message-control/package.json b/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/package.json new file mode 100644 index 00000000..858a8015 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/package.json @@ -0,0 +1,129 @@ +{ + "_from": "remark-message-control@^6.0.0", + "_id": "remark-message-control@6.0.0", + "_inBundle": false, + "_integrity": "sha512-k9bt7BYc3G7YBdmeAhvd3VavrPa/XlKWR3CyHjr4sLO9xJyly8WHHT3Sp+8HPR8lEUv+/sZaffL7IjMLV0f6BA==", + "_location": "/remark-preset-lint-consistent/remark-message-control", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-message-control@^6.0.0", + "name": "remark-message-control", + "escapedName": "remark-message-control", + "rawSpec": "^6.0.0", + "saveSpec": null, + "fetchSpec": "^6.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent/remark-lint" + ], + "_resolved": "https://registry.npmjs.org/remark-message-control/-/remark-message-control-6.0.0.tgz", + "_shasum": "955b054b38c197c9f2e35b1d88a4912949db7fc5", + "_spec": "remark-message-control@^6.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent/node_modules/remark-lint", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-message-control/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": { + "mdast-comment-marker": "^1.0.0", + "unified-message-control": "^3.0.0" + }, + "deprecated": false, + "description": "remark plugin to enable, disable, and ignore messages with remark", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^11.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "remark-toc": "^7.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.28.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/remarkjs/remark-message-control#readme", + "keywords": [ + "unified", + "remark", + "remark-plugin", + "plugin", + "mdast", + "markdown", + "comment", + "message", + "marker", + "control" + ], + "license": "MIT", + "name": "remark-message-control", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/remarkjs/remark-message-control.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s remarkMessageControl > remark-message-control.js", + "build-mangle": "browserify . -s remarkMessageControl -p tinyify > remark-message-control.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "6.0.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/string-content": "off", + "guard-for-in": "off" + }, + "ignores": [ + "remark-message-control.js" + ] + } +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/readme.md new file mode 100644 index 00000000..850e9dd3 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control/readme.md @@ -0,0 +1,228 @@ +# remark-message-control + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**remark**][remark] plugin to enable, disable, and ignore messages. + +## Install + +[npm][]: + +```sh +npm install remark-message-control +``` + +## Use + +Say we have the following file, `example.md`: + +```markdown + + +## Heading +``` + +And our script, `example.js`, looks as follows: + +```js +var vfile = require('to-vfile') +var report = require('vfile-reporter') +var remark = require('remark') +var control = require('remark-message-control') + +remark() + .use(warn) + .use(control, {name: 'foo'}) + .process(vfile.readSync('example.md'), function(err, file) { + console.error(report(err || file)) + }) + +function warn() { + return function(tree, file) { + file.message('Whoops!', tree.children[1], 'foo:thing') + } +} +``` + +Now, running `node example` yields: + +```markdown +example.md: no issues found +``` + +## API + +### `remark().use(control, options)` + +Let comment markers control messages from a certain sources. + +##### Options + +###### `options.name` + +Name of markers that can control the message sources (`string`). + +For example, `{name: 'alpha'}` controls `alpha` markers: + +```markdown + +``` + +###### `options.known` + +List of allowed `ruleId`s (`Array.`, optional). +When given, a warning is shown when someone tries to control an unknown rule. + +For example, `{name: 'alpha', known: ['bravo']}` results in a warning if +`charlie` is configured: + +```markdown + +``` + +###### `options.reset` + +Whether to treat all messages as turned off initially (`boolean`, default: +`false`). + +###### `options.enable` + +List of `ruleId`s to initially turn on if `reset: true` (`Array.`, +optional). +By default (`reset: false`), all rules are turned on. + +###### `options.disable` + +List of `ruleId`s to turn on if `reset: false` (`Array.`, optional). + +###### `options.sources` + +Sources that can be controlled with `name` markers (`string` or +`Array.`, default: `options.name`). + +### Markers + +###### `disable` + +The **disable** keyword turns off all messages of the given rule identifiers. +When without identifiers, all messages are turned off. + +For example, to turn off certain messages: + +```markdown + + +* **foo** + +A paragraph, and now another list. + + * __bar__ +``` + +###### `enable` + +The **enable** keyword turns on all messages of the given rule identifiers. +When without identifiers, all messages are turned on. + +For example, to enable certain messages: + +```markdown + + +**foo** and __bar__. +``` + +###### `ignore` + +The **ignore** keyword turns off all messages of the given `ruleId`s occurring +in the following node. +When without `ruleId`s, all messages are ignored. + +After the end of the following node, messages are turned on again. + +For example, to turn off certain messages for the next node: + +```markdown + + +* **foo** + * __bar__ +``` + +## Security + +Use of `remark-message-control` does not involve [**rehype**][rehype] +([**hast**][hast]) or user content so there are no openings for +[cross-site scripting (XSS)][xss] attacks. +Messages may be hidden from user content though, causing builds to fail or pass, +or changing a report. + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-message-control/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-message-control + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-message-control.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-message-control + +[downloads-badge]: https://img.shields.io/npm/dm/remark-message-control.svg + +[downloads]: https://www.npmjs.com/package/remark-message-control + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-message-control.svg + +[size]: https://bundlephobia.com/result?p=remark-message-control + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: license + +[author]: https://wooorm.com + +[remark]: https://github.com/remarkjs/remark + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[rehype]: https://github.com/rehypejs/rehype + +[hast]: https://github.com/syntax-tree/hast diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/index.d.ts b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/index.d.ts new file mode 100644 index 00000000..953eba08 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/index.d.ts @@ -0,0 +1,116 @@ +// TypeScript Version: 3.4 + +import {Node} from 'unist' +import {Transformer} from 'unified' +import {Test} from 'unist-util-is' + +declare namespace messageControl { + /** + * A comment marker. + */ + interface Marker { + /** + * Name of marker + */ + name: string + + /** + * Value after name + */ + attributes: string + + /** + * Parsed attributes + */ + parameters: Record + + /** + * Reference to given node + */ + node: N + } + + /** + * Parse a possible comment marker node to a Marker + */ + type MarkerParser = (node: N) => Marker | null + + interface MessageControlOptionsWithReset + extends BaseMessageControlOptions { + /** + * Whether to treat all messages as turned off initially + */ + reset: true + + /** + * List of `ruleId`s to initially turn on. + */ + enable?: string[] + } + + interface MessageControlOptionsWithoutReset + extends BaseMessageControlOptions { + /** + * Whether to treat all messages as turned off initially + */ + reset?: false + + /** + * List of `ruleId`s to turn off + */ + disable?: string[] + } + + interface BaseMessageControlOptions { + /** + * Name of markers that can control the message sources. + * + * For example. `{name: 'alpha'}` controls `alpha` markers: + * + * `` + */ + name: string + + /** + * Test for possible markers + */ + test: Test + + /** + * Parse a possible marker to a comment marker object (Marker) + * if possible the marker isn't a marker, should return `null`. + */ + marker: MarkerParser + + /** + * List of allowed `ruleId`s. When given a warning is shown + * when someone tries to control an unknown rule. + * + * For example, `{name: 'alpha', known: ['bravo']}` results + * in a warning if `charlie is configured: + * + * `` + */ + known?: string[] + + /** + * Sources that can be controlled with `name` markers. + * + * @defaultValue `MessageControlOptions.name` + */ + sources?: string | string[] + } + + type MessageControlOptions = + | MessageControlOptionsWithoutReset + | MessageControlOptionsWithReset +} + +/** + * Enable, disable, and ignore messages with unified. + */ +declare function messageControl( + options?: messageControl.MessageControlOptions +): Transformer + +export = messageControl diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/index.js b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/index.js new file mode 100644 index 00000000..1a1dd6ea --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/index.js @@ -0,0 +1,293 @@ +'use strict' + +var location = require('vfile-location') +var visit = require('unist-util-visit') + +module.exports = messageControl + +function messageControl(options) { + var settings = options || {} + var name = settings.name + var marker = settings.marker + var test = settings.test + var sources = settings.source + var known = settings.known + var reset = settings.reset + var enable = settings.enable || [] + var disable = settings.disable || [] + + if (!name) { + throw new Error('Expected `name` in `options`, got `' + name + '`') + } + + if (!marker) { + throw new Error('Expected `marker` in `options`, got `' + marker + '`') + } + + if (!sources) { + sources = [name] + } else if (typeof sources === 'string') { + sources = [sources] + } + + return transformer + + function transformer(tree, file) { + var toOffset = location(file).toOffset + var initial = !reset + var gaps = detectGaps(tree, file) + var scope = {} + var globals = [] + + visit(tree, test, visitor) + + file.messages = file.messages.filter(filter) + + function visitor(node, position, parent) { + var mark = marker(node) + var ruleIds + var ruleId + var verb + var index + var length + var next + var pos + var tail + + if (!mark || mark.name !== name) { + return + } + + ruleIds = mark.attributes.split(/\s/g) + verb = ruleIds.shift() + next = parent.children[position + 1] + pos = mark.node.position && mark.node.position.start + tail = next && next.position && next.position.end + + if (verb !== 'enable' && verb !== 'disable' && verb !== 'ignore') { + file.fail( + 'Unknown keyword `' + + verb + + '`: expected ' + + "`'enable'`, `'disable'`, or `'ignore'`", + mark.node + ) + } + + length = ruleIds.length + index = -1 + + // Apply to all rules. + if (length === 0) { + if (verb === 'ignore') { + toggle(pos, false) + toggle(tail, true) + } else { + toggle(pos, verb === 'enable') + reset = verb !== 'enable' + } + } else { + while (++index < length) { + ruleId = ruleIds[index] + + if (isKnown(ruleId, verb, mark.node)) { + toggle(pos, verb === 'enable', ruleId) + + if (verb === 'ignore') { + toggle(tail, true, ruleId) + } + } + } + } + } + + function filter(message) { + var gapIndex = gaps.length + var ruleId = message.ruleId + var ranges = scope[ruleId] + var pos + + // Keep messages from a different source. + if (!message.source || sources.indexOf(message.source) === -1) { + return true + } + + // We only ignore messages if they‘re disabled, *not* when they’re not in + // the document. + if (!message.line) { + message.line = 1 + } + + if (!message.column) { + message.column = 1 + } + + // Check whether the warning is inside a gap. + pos = toOffset(message) + + while (gapIndex--) { + if (gaps[gapIndex].start <= pos && gaps[gapIndex].end > pos) { + return false + } + } + + // Check whether allowed by specific and global states. + return check(message, ranges, ruleId) && check(message, globals) + } + + // Helper to check (and possibly warn) if a `ruleId` is unknown. + function isKnown(ruleId, verb, pos) { + var result = known ? known.indexOf(ruleId) !== -1 : true + + if (!result) { + file.message( + 'Unknown rule: cannot ' + verb + " `'" + ruleId + "'`", + pos + ) + } + + return result + } + + // Get the latest state of a rule. + // When without `ruleId`, gets global state. + function getState(ruleId) { + var ranges = ruleId ? scope[ruleId] : globals + + if (ranges && ranges.length !== 0) { + return ranges[ranges.length - 1].state + } + + if (!ruleId) { + return !reset + } + + if (reset) { + return enable.indexOf(ruleId) !== -1 + } + + return disable.indexOf(ruleId) === -1 + } + + // Handle a rule. + function toggle(pos, state, ruleId) { + var markers = ruleId ? scope[ruleId] : globals + var previousState + + if (!markers) { + markers = [] + scope[ruleId] = markers + } + + previousState = getState(ruleId) + + if (state !== previousState) { + markers.push({state: state, position: pos}) + } + + // Toggle all known rules. + if (!ruleId) { + for (ruleId in scope) { + toggle(pos, state, ruleId) + } + } + } + + // Check all `ranges` for `message`. + function check(message, ranges, id) { + // Check the state at the message’s position. + var index = ranges && ranges.length + var length = -1 + var range + + while (--index > length) { + range = ranges[index] + + /* istanbul ignore if - Generated marker. */ + if (!range.position || !range.position.line || !range.position.column) { + continue + } + + if ( + range.position.line < message.line || + (range.position.line === message.line && + range.position.column <= message.column) + ) { + return range.state === true + } + } + + // The first marker ocurred after the first message, so we check the + // initial state. + if (!id) { + return initial || reset + } + + return reset ? enable.indexOf(id) !== -1 : disable.indexOf(id) === -1 + } + } +} + +// Detect gaps in `tree`. +function detectGaps(tree, file) { + var lastNode = tree.children[tree.children.length - 1] + var offset = 0 + var isGap = false + var gaps = [] + + // Find all gaps. + visit(tree, one) + + // Get the end of the document. + // This detects if the last node was the last node. + // If not, there’s an extra gap between the last node and the end of the + // document. + if ( + lastNode && + lastNode.position && + lastNode.position.end && + offset === lastNode.position.end.offset && + trim(file.toString().slice(offset)) !== '' + ) { + update() + + update( + tree && tree.position && tree.position.end && tree.position.end.offset - 1 + ) + } + + return gaps + + function one(node) { + var pos = node.position + + update(pos && pos.start && pos.start.offset) + + if (!node.children) { + update(pos && pos.end && pos.end.offset) + } + } + + // Detect a new position. + function update(latest) { + if (latest === null || latest === undefined) { + isGap = true + return + } + + if (offset >= latest) { + return + } + + if (isGap) { + gaps.push({start: offset, end: latest}) + isGap = false + } + + offset = latest + } +} + +function trim(value) { + return value.replace(/^\s*|\s*$/g, '') +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/license b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-preset-lint-consistent/node_modules/unified-message-control/package.json b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/package.json new file mode 100644 index 00000000..2d7e83f5 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/package.json @@ -0,0 +1,141 @@ +{ + "_from": "unified-message-control@^3.0.0", + "_id": "unified-message-control@3.0.1", + "_inBundle": false, + "_integrity": "sha512-K2Kvvp1DBzeuxYLLsumZh/gDWUTl4e2z/P3VReFirC78cfHKtQifbhnfRrSBtKtd1Uc6cvYTW0/SZIUaMAEcTg==", + "_location": "/remark-preset-lint-consistent/unified-message-control", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unified-message-control@^3.0.0", + "name": "unified-message-control", + "escapedName": "unified-message-control", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent/remark-message-control" + ], + "_resolved": "https://registry.npmjs.org/unified-message-control/-/unified-message-control-3.0.1.tgz", + "_shasum": "7018855daea9af96082cbea35970d48c9c4dbbf2", + "_spec": "unified-message-control@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent/node_modules/remark-message-control", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/unifiedjs/unified-message-control/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com", + "url": "https://github.com/ChristianMurphy" + }, + { + "name": "Thomas 'zemnmez' Shadwell", + "url": "https://github.com/zemnmez" + } + ], + "dependencies": { + "unist-util-visit": "^2.0.0", + "vfile-location": "^3.0.0" + }, + "deprecated": false, + "description": "Enable, disable, and ignore messages from unified processors", + "devDependencies": { + "@types/hast": "^2.0.0", + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "esmangle": "^1.0.0", + "mdast-comment-marker": "^1.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^11.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "remark-toc": "^7.0.0", + "tape": "^4.0.0", + "unified": "^8.0.0", + "unist-util-is": "^4.0.0", + "xo": "^0.28.0" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/unifiedjs/unified-message-control#readme", + "keywords": [ + "unified", + "unified-plugin", + "comment", + "message", + "marker", + "control" + ], + "license": "MIT", + "name": "unified-message-control", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/unifiedjs/unified-message-control.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s unifiedMessageControl > unified-message-control.js", + "build-mangle": "esmangle unified-message-control.js > unified-message-control.min.js", + "format": "remark . -qfo && prettier --write '**/*.{js,ts}' && xo --fix", + "test": "npm run test-types && npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint" + }, + "version": "3.0.1", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "@typescript-eslint/no-unused-vars": "off", + "unicorn/string-content": "off", + "unicorn/prefer-includes": "off", + "guard-for-in": "off" + }, + "ignores": [ + "unified-message-control.js" + ] + } +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/readme.md new file mode 100644 index 00000000..a81d6cda --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control/readme.md @@ -0,0 +1,229 @@ +# unified-message-control + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Enable, disable, and ignore messages with [**unified**][unified]. + +## Install + +[npm][]: + +```sh +npm install unified-message-control +``` + +## Use + +Say we have the following file, `example.md`: + +```markdown + + +## Heading +``` + +And our script, `example.js`, looks as follows: + +```js +var vfile = require('to-vfile') +var report = require('vfile-reporter') +var remark = require('remark') +var control = require('unified-message-control') +var mdastMarker = require('mdast-comment-marker') + +remark() + .use(warn) + .use(control, {name: 'foo', marker: mdastMarker, test: 'html'}) + .process(vfile.readSync('example.md'), function (err, file) { + console.error(report(err || file)) + }) + +function warn() { + return function (tree, file) { + file.message('Whoops!', tree.children[1], 'foo:thing') + } +} +``` + +Now, running `node example` yields: + +```markdown +example.md: no issues found +``` + +## API + +### `unified.use(control, options)` + +Let comment markers control messages from certain sources. + +##### Options + +###### `options.name` + +Name of markers that can control the message sources (`string`). + +For example, `{name: 'alpha'}` controls `alpha` markers: + +```markdown + +``` + +###### `options.test` + +Test for possible markers (`Function`, `string`, `Object`, or `Array.`). +See [`unist-util-is`][test]. + +###### `options.marker` + +Parse a possible marker to a [comment marker object][marker] (`Function`). +If the possible marker actually isn’t a marker, should return `null`. + +###### `options.known` + +List of allowed `ruleId`s (`Array.`, optional). +When given, a warning is shown when someone tries to control an unknown rule. + +For example, `{name: 'alpha', known: ['bravo']}` results in a warning if +`charlie` is configured: + +```markdown + +``` + +###### `options.reset` + +Whether to treat all messages as turned off initially (`boolean`, default: +`false`). + +###### `options.enable` + +List of `ruleId`s to initially turn on if `reset: true` +(`Array.`, optional). +By default (`reset: false`), all rules are turned on. + +###### `options.disable` + +List of `ruleId`s to turn on if `reset: false` (`Array.`, optional). + +###### `options.sources` + +Sources that can be controlled with `name` markers (`string` or +`Array.`, default: `options.name`) + +### Markers + +###### `disable` + +The **disable** keyword turns off all messages of the given rule identifiers. +When without identifiers, all messages are turned off. + +For example, to turn off certain messages: + +```markdown + + +* **foo** + +A paragraph, and now another list. + + * __bar__ +``` + +###### `enable` + +The **enable** keyword turns on all messages of the given rule identifiers. +When without identifiers, all messages are turned on. + +For example, to enable certain messages: + +```markdown + + +**foo** and __bar__. +``` + +###### `ignore` + +The **ignore** keyword turns off all messages of the given `ruleId`s occurring +in the following node. +When without `ruleId`s, all messages are ignored. + +After the end of the following node, messages are turned on again. + +For example, to turn off certain messages for the next node: + +```markdown + + +* **foo** + * __bar__ +``` + +## Contribute + +See [`contributing.md`][contributing] in [`unifiedjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/unifiedjs/unified-message-control.svg + +[build]: https://travis-ci.org/unifiedjs/unified-message-control + +[coverage-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified-message-control.svg + +[coverage]: https://codecov.io/github/unifiedjs/unified-message-control + +[downloads-badge]: https://img.shields.io/npm/dm/unified-message-control.svg + +[downloads]: https://www.npmjs.com/package/unified-message-control + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unified-message-control.svg + +[size]: https://bundlephobia.com/result?p=unified-message-control + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/unifiedjs/.github + +[contributing]: https://github.com/unifiedjs/.github/blob/master/contributing.md + +[support]: https://github.com/unifiedjs/.github/blob/master/support.md + +[coc]: https://github.com/unifiedjs/.github/blob/master/code-of-conduct.md + +[license]: license + +[author]: https://wooorm.com + +[marker]: https://github.com/syntax-tree/mdast-comment-marker#marker + +[unified]: https://github.com/unifiedjs/unified + +[test]: https://github.com/syntax-tree/unist-util-is#api diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/convert.d.ts b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/convert.d.ts new file mode 100644 index 00000000..ce80aea8 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/convert.d.ts @@ -0,0 +1,6 @@ +import {Test, TestFunction} from './' +import {Node} from 'unist' + +declare function convert(test: Test): TestFunction + +export = convert diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/convert.js b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/convert.js new file mode 100644 index 00000000..f92f34f1 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/convert.js @@ -0,0 +1,87 @@ +'use strict' + +module.exports = convert + +function convert(test) { + if (typeof test === 'string') { + return typeFactory(test) + } + + if (test === null || test === undefined) { + return ok + } + + if (typeof test === 'object') { + return ('length' in test ? anyFactory : matchesFactory)(test) + } + + if (typeof test === 'function') { + return test + } + + throw new Error('Expected function, string, or object as test') +} + +function convertAll(tests) { + var results = [] + var length = tests.length + var index = -1 + + while (++index < length) { + results[index] = convert(tests[index]) + } + + return results +} + +// Utility assert each property in `test` is represented in `node`, and each +// values are strictly equal. +function matchesFactory(test) { + return matches + + function matches(node) { + var key + + for (key in test) { + if (node[key] !== test[key]) { + return false + } + } + + return true + } +} + +function anyFactory(tests) { + var checks = convertAll(tests) + var length = checks.length + + return matches + + function matches() { + var index = -1 + + while (++index < length) { + if (checks[index].apply(this, arguments)) { + return true + } + } + + return false + } +} + +// Utility to convert a string into a function which checks a given node’s type +// for said string. +function typeFactory(test) { + return type + + function type(node) { + return Boolean(node && node.type === test) + } +} + +// Utility to return true. +function ok() { + return true +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/index.d.ts b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/index.d.ts new file mode 100644 index 00000000..f05d502f --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/index.d.ts @@ -0,0 +1,66 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' + +declare namespace unistUtilIs { + /** + * Check that type property matches expectation for a node + * + * @typeParam T type of node that passes test + */ + type TestType = T['type'] + + /** + * Check that some attributes on a node are matched + * + * @typeParam T type of node that passes test + */ + type TestObject = Partial + + /** + * Check if a node passes a test + * + * @param node node to check + * @param index index of node in parent + * @param parent parent of node + * @typeParam T type of node that passes test + * @returns true if type T is found, false otherwise + */ + type TestFunction = ( + node: unknown, + index?: number, + parent?: Parent + ) => node is T + + /** + * Union of all the types of tests + * + * @typeParam T type of node that passes test + */ + type Test = TestType | TestObject | TestFunction +} + +/** + * Unist utility to check if a node passes a test. + * + * @param node Node to check. + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `function` checks if function passed the node is true. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values. + * When `array`, checks any one of the subtests pass. + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @typeParam T type that node is compared with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs( + node: unknown, + test: unistUtilIs.Test | Array>, + index?: number, + parent?: Parent, + context?: any +): node is T + +export = unistUtilIs diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/index.js b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/index.js new file mode 100644 index 00000000..f18d416e --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/index.js @@ -0,0 +1,37 @@ +'use strict' + +var convert = require('./convert') + +module.exports = is + +is.convert = convert + +// Assert if `test` passes for `node`. +// When a `parent` node is known the `index` of node should also be given. +// eslint-disable-next-line max-params +function is(node, test, index, parent, context) { + var hasParent = parent !== null && parent !== undefined + var hasIndex = index !== null && index !== undefined + var check = convert(test) + + if ( + hasIndex && + (typeof index !== 'number' || index < 0 || index === Infinity) + ) { + throw new Error('Expected positive finite index or child node') + } + + if (hasParent && (!is(parent) || !parent.children)) { + throw new Error('Expected parent node') + } + + if (!node || !node.type || typeof node.type !== 'string') { + return false + } + + if (hasParent !== hasIndex) { + throw new Error('Expected both parent and index') + } + + return Boolean(check.call(context, node, index, parent)) +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/license b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/license new file mode 100644 index 00000000..cfa79e66 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/license @@ -0,0 +1,22 @@ +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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/remark-preset-lint-consistent/node_modules/unist-util-is/package.json b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/package.json new file mode 100644 index 00000000..63aae5d3 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/package.json @@ -0,0 +1,134 @@ +{ + "_from": "unist-util-is@^4.0.0", + "_id": "unist-util-is@4.0.2", + "_inBundle": false, + "_integrity": "sha512-Ofx8uf6haexJwI1gxWMGg6I/dLnF2yE+KibhD3/diOqY2TinLcqHXCV6OI5gFVn3xQqDH+u0M625pfKwIwgBKQ==", + "_location": "/remark-preset-lint-consistent/unist-util-is", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-is@^4.0.0", + "name": "unist-util-is", + "escapedName": "unist-util-is", + "rawSpec": "^4.0.0", + "saveSpec": null, + "fetchSpec": "^4.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent/unist-util-visit", + "/remark-preset-lint-consistent/unist-util-visit-parents" + ], + "_resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.0.2.tgz", + "_shasum": "c7d1341188aa9ce5b3cff538958de9895f14a5de", + "_spec": "unist-util-is@^4.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-is/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "unist utility to check if a node passes a test", + "devDependencies": { + "@types/mdast": "^3.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "unified": "^8.0.0", + "xo": "^0.26.0" + }, + "files": [ + "index.js", + "convert.js", + "index.d.ts", + "convert.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-is#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "node", + "is", + "equal", + "check", + "test", + "type" + ], + "license": "MIT", + "name": "unist-util-is", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-is.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilIs > unist-util-is.js", + "build-mangle": "browserify . -s unistUtilIs -p tinyify > unist-util-is.min.js", + "format": "remark . -qfo && prettier --write \"**/*.{js,ts}\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint ." + }, + "types": "index.d.ts", + "version": "4.0.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-type-error": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignore": [ + "unist-util-is.js" + ] + } +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/readme.md new file mode 100644 index 00000000..9e67054f --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-is/readme.md @@ -0,0 +1,205 @@ +# unist-util-is + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a node passes a test. + +## Install + +[npm][]: + +```sh +npm install unist-util-is +``` + +## Use + +```js +var is = require('unist-util-is') + +var node = {type: 'strong'} +var parent = {type: 'paragraph', children: [node]} + +function test(node, n) { + return n === 5 +} + +is() // => false +is({children: []}) // => false +is(node) // => true +is(node, 'strong') // => true +is(node, 'emphasis') // => false + +is(node, node) // => true +is(parent, {type: 'paragraph'}) // => true +is(parent, {type: 'strong'}) // => false + +is(node, test) // => false +is(node, test, 4, parent) // => false +is(node, test, 5, parent) // => true +``` + +## API + +### `is(node[, test[, index, parent[, context]]])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. +* `test` ([`Function`][test], `string`, `Object`, or `Array.`, optional) + — When not given, checks if `node` is a [`Node`][node]. + When `string`, works like passing `node => node.type === test`. + When `array`, checks if any one of the subtests pass. + When `object`, checks that all keys in `test` are in `node`, + and that they have strictly equal values +* `index` (`number`, optional) — [Index][] of `node` in `parent` +* `parent` ([`Node`][node], optional) — [Parent][] of `node` +* `context` (`*`, optional) — Context object to invoke `test` with + +###### Returns + +`boolean` — Whether `test` passed *and* `node` is a [`Node`][node] (object with +`type` set to a non-empty `string`). + +#### `function test(node[, index, parent])` + +###### Parameters + +* `node` ([`Node`][node]) — Node to check +* `index` (`number?`) — [Index][] of `node` in `parent` +* `parent` ([`Node?`][node]) — [Parent][] of `node` + +###### Context + +`*` — The to `is` given `context`. + +###### Returns + +`boolean?` — Whether `node` matches. + +### `is.convert(test)` + +Create a test function from `test`, that can later be called with a `node`, +`index`, and `parent`. +Useful if you’re going to test many nodes, for example when creating a utility +where something else passes an is-compatible test. + +The created function is slightly faster because it expects valid input only. +Therefore, passing invalid input, yields unexpected results. + +Can also be accessed with `require('unist-util-is/convert')`. + +For example: + +```js +var u = require('unist-builder') +var convert = require('unist-util-is/convert') + +var test = convert('leaf') + +var tree = u('tree', [ + u('node', [u('leaf', '1')]), + u('leaf', '2'), + u('node', [u('leaf', '3'), u('leaf', '4')]), + u('leaf', '5') +]) + +var leafs = tree.children.filter((child, index) => test(child, index, tree)) + +console.log(leafs) +``` + +Yields: + +```js +[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}] +``` + +## Related + +* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after) + — Find a node after another node +* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before) + — Find a node before another node +* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after) + — Find all nodes after another node +* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before) + — Find all nodes before another node +* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between) + — Find all nodes between two nodes +* [`unist-util-find`](https://github.com/blahah/unist-util-find) + — Find nodes matching a predicate +* [`unist-util-filter`](https://github.com/eush77/unist-util-filter) + — Create a new tree with nodes that pass a check +* [`unist-util-remove`](https://github.com/eush77/unist-util-remove) + — Remove nodes from tree + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-is.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-is + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-is + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg + +[downloads]: https://www.npmjs.com/package/unist-util-is + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-is.svg + +[size]: https://bundlephobia.com/result?p=unist-util-is + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[index]: https://github.com/syntax-tree/unist#index + +[test]: #function-testnode-index-parent diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/color.browser.js b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/color.browser.js new file mode 100644 index 00000000..db22a1e6 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/color.browser.js @@ -0,0 +1,4 @@ +module.exports = identity +function identity(d) { + return d +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/color.js b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/color.js new file mode 100644 index 00000000..2e2974c9 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/color.js @@ -0,0 +1,4 @@ +module.exports = color +function color(d) { + return '\u001B[33m' + d + '\u001B[39m' +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/index.js b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/index.js new file mode 100644 index 00000000..a862c86f --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/index.js @@ -0,0 +1,110 @@ +'use strict' + +module.exports = visitParents + +var convert = require('unist-util-is/convert') +var color = require('./color') + +var CONTINUE = true +var SKIP = 'skip' +var EXIT = false + +visitParents.CONTINUE = CONTINUE +visitParents.SKIP = SKIP +visitParents.EXIT = EXIT + +function visitParents(tree, test, visitor, reverse) { + var is + + if (func(test) && !func(visitor)) { + reverse = visitor + visitor = test + test = null + } + + is = convert(test) + + one(tree, null, [])() + + function one(child, index, parents) { + var value = object(child) ? child : {} + var name + + if (string(value.type)) { + name = string(value.tagName) + ? value.tagName + : string(value.name) + ? value.name + : undefined + + node.displayName = + 'node (' + color(value.type + (name ? '<' + name + '>' : '')) + ')' + } + + return node + + function node() { + var result = [] + var subresult + + if (!test || is(child, index, parents[parents.length - 1] || null)) { + result = toResult(visitor(child, parents)) + + if (result[0] === EXIT) { + return result + } + } + + if (!child.children || result[0] === SKIP) { + return result + } + + subresult = toResult(children(child.children, parents.concat(child))) + return subresult[0] === EXIT ? subresult : result + } + } + + // Visit children in `parent`. + function children(children, parents) { + var min = -1 + var step = reverse ? -1 : 1 + var index = (reverse ? children.length : min) + step + var child + var result + + while (index > min && index < children.length) { + child = children[index] + result = one(child, index, parents)() + + if (result[0] === EXIT) { + return result + } + + index = typeof result[1] === 'number' ? result[1] : index + step + } + } +} + +function toResult(value) { + if (object(value) && 'length' in value) { + return value + } + + if (typeof value === 'number') { + return [CONTINUE, value] + } + + return [value] +} + +function func(d) { + return typeof d === 'function' +} + +function string(d) { + return typeof d === 'string' +} + +function object(d) { + return typeof d === 'object' && d !== null +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/license b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/package.json b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/package.json new file mode 100644 index 00000000..81dae6f5 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/package.json @@ -0,0 +1,142 @@ +{ + "_from": "unist-util-visit-parents@^3.0.0", + "_id": "unist-util-visit-parents@3.1.0", + "_inBundle": false, + "_integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==", + "_location": "/remark-preset-lint-consistent/unist-util-visit-parents", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit-parents@^3.0.0", + "name": "unist-util-visit-parents", + "escapedName": "unist-util-visit-parents", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent/unist-util-visit" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz", + "_shasum": "4dd262fb9dcfe44f297d53e882fc6ff3421173d5", + "_spec": "unist-util-visit-parents@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "browser": { + "./color.js": "./color.browser.js" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit-parents/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0" + }, + "deprecated": false, + "description": "unist utility to recursively walk over nodes, with ancestral information", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "strip-ansi": "^6.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "color.js", + "color.browser.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit-parents#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "tree", + "ast", + "visit", + "traverse", + "walk", + "check", + "parent", + "parents" + ], + "license": "MIT", + "name": "unist-util-visit-parents", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "react-native": { + "./color.js": "./color.browser.js" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit-parents.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unistUtilVisitParents > unist-util-visit-parents.js", + "build-mangle": "browserify index.js -s unistUtilVisitParents -p tinyify > unist-util-visit-parents.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off", + "unicorn/prefer-reflect-apply": "off" + }, + "ignores": [ + "types/", + "unist-util-visit-parents.js" + ] + } +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/readme.md new file mode 100644 index 00000000..0c03a41d --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/readme.md @@ -0,0 +1,233 @@ +# unist-util-visit-parents + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes, with ancestral information. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit-parents +``` + +## Use + +```js +var remark = require('remark') +var visit = require('unist-util-visit-parents') + +var tree = remark.parse('Some _emphasis_, **importance**, and `code`.') + +visit(tree, 'strong', visitor) + +function visitor(node, ancestors) { + console.log(ancestors) +} +``` + +Yields: + +```js +[ { type: 'root', children: [ [Object] ] }, + { type: 'paragraph', + children: + [ [Object], + [Object], + [Object], + [Object], + [Object], + [Object], + [Object] ] } ] +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +Visit nodes ([*inclusive descendants*][descendant] of [`tree`][tree]), with +ancestral information. +Optionally filtering nodes. +Optionally in reverse. + +This algorithm performs [*depth-first*][depth-first] +[*tree traversal*][tree-traversal] in [*preorder*][preorder] (**NLR**), or +if `reverse` is given, in *reverse preorder* (**NRL**). + +Walking the tree is an intensive task. +Make use of the return values of the visitor when possible. +Instead of walking a tree multiple times with different `test`s, walk it once +without a test, and use [`unist-util-is`][is] to check if a node matches a test, +and then perform different operations. + +###### Parameters + +* `tree` ([`Node`][node]) — [Tree][] to traverse +* `test` ([`Test`][is], optional) — [`is`][is]-compatible test (such as a + [type][]) +* `visitor` ([Function][visitor]) — Function invoked when a node is found + that passes `test` +* `reverse` (`boolean`, default: `false`) — The tree is traversed in + [preorder][] (NLR), visiting the node itself, then its [head][], etc. + When `reverse` is passed, the tree is traversed in reverse preorder (NRL): + the node itself is visited, then its [tail][], etc. + +#### `next? = visitor(node, ancestors)` + +Invoked when a node (matching `test`, if given) is found. + +Visitors are free to transform `node`. +They can also transform the [parent][] of node (the last of `ancestors`). +Replacing `node` itself, if `visit.SKIP` is not returned, still causes its +[descendant][]s to be visited. +If adding or removing previous [sibling][]s (or next siblings, in case of +`reverse`) of `node`, `visitor` should return a new [`index`][index] (`number`) +to specify the sibling to traverse after `node` is traversed. +Adding or removing next siblings of `node` (or previous siblings, in case of +reverse) is handled as expected without needing to return a new `index`. +Removing the `children` property of an ancestor still results in them being +traversed. + +###### Parameters + +* `node` ([`Node`][node]) — Found node +* `ancestors` (`Array.`) — [Ancestor][]s of `node` + +##### Returns + +The return value can have the following forms: + +* [`index`][index] (`number`) — Treated as a tuple of `[CONTINUE, index]` +* `action` (`*`) — Treated as a tuple of `[action]` +* `tuple` (`Array.<*>`) — List with one or two values, the first an `action`, + the second and `index`. + Note that passing a tuple only makes sense if the `action` is `SKIP`. + If the `action` is `EXIT`, that action can be returned. + If the `action` is `CONTINUE`, `index` can be returned. + +###### `action` + +An action can have the following values: + +* `visit.EXIT` (`false`) — Stop traversing immediately +* `visit.CONTINUE` (`true`) — Continue traversing as normal (same behaviour + as not returning anything) +* `visit.SKIP` (`'skip'`) — Do not traverse this node’s children; continue + with the specified index + +###### `index` + +[`index`][index] (`number`) — Move to the sibling at `index` next (after `node` +itself is completely traversed). +Useful if mutating the tree, such as removing the node the visitor is currently +on, or any of its previous siblings (or next siblings, in case of `reverse`) +Results less than `0` or greater than or equal to `children.length` stop +traversing the parent + +## Related + +* [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) + — Like `visit-parents`, but with one parent +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit-parents.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit-parents + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit-parents.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit-parents + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit-parents.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit-parents + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit-parents.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit-parents + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[visitor]: #next--visitornode-ancestors + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[is]: https://github.com/syntax-tree/unist-util-is + +[depth-first]: https://github.com/syntax-tree/unist#depth-first-traversal + +[tree-traversal]: https://github.com/syntax-tree/unist#tree-traversal + +[preorder]: https://github.com/syntax-tree/unist#preorder + +[descendant]: https://github.com/syntax-tree/unist#descendant + +[head]: https://github.com/syntax-tree/unist#head + +[tail]: https://github.com/syntax-tree/unist#tail + +[parent]: https://github.com/syntax-tree/unist#parent-1 + +[sibling]: https://github.com/syntax-tree/unist#sibling + +[index]: https://github.com/syntax-tree/unist#index + +[ancestor]: https://github.com/syntax-tree/unist#ancestor + +[tree]: https://github.com/syntax-tree/unist#tree + +[type]: https://github.com/syntax-tree/unist#type diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/types/index.d.ts b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/types/index.d.ts new file mode 100644 index 00000000..53a37c4b --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit-parents/types/index.d.ts @@ -0,0 +1,111 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' + +declare namespace visitParents { + /** + * Continue traversing as normal + */ + type Continue = true + + /** + * Do not traverse this node’s children + */ + type Skip = 'skip' + + /** + * Stop traversing immediately + */ + type Exit = false + + /** + * Union of the action types + */ + type Action = Continue | Skip | Exit + + /** + * List with one or two values, the first an action, the second an index. + */ + type ActionTuple = [Action, Index] + + /** + * Move to the sibling at index next (after node itself is completely traversed). + * Useful if mutating the tree, such as removing the node the visitor is currently on, + * or any of its previous siblings (or next siblings, in case of reverse) + * Results less than 0 or greater than or equal to children.length stop traversing the parent + */ + type Index = number + + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node (the last of ancestors). + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of an ancestor still results in them being traversed. + * + * @param node Found node + * @param ancestors Ancestors of node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + ancestors: Node[] + ) => void | Action | Index | ActionTuple +} + +declare const visitParents: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visitParents.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visitParents.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: visitParents.Continue + + /** + * Do not traverse this node’s children + */ + SKIP: visitParents.Skip + + /** + * Stop traversing immediately + */ + EXIT: visitParents.Exit +} + +export = visitParents diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/index.js b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/index.js new file mode 100644 index 00000000..39970e7d --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/index.js @@ -0,0 +1,29 @@ +'use strict' + +module.exports = visit + +var visitParents = require('unist-util-visit-parents') + +var CONTINUE = visitParents.CONTINUE +var SKIP = visitParents.SKIP +var EXIT = visitParents.EXIT + +visit.CONTINUE = CONTINUE +visit.SKIP = SKIP +visit.EXIT = EXIT + +function visit(tree, test, visitor, reverse) { + if (typeof test === 'function' && typeof visitor !== 'function') { + reverse = visitor + visitor = test + test = null + } + + visitParents(tree, test, overload, reverse) + + function overload(node, parents) { + var parent = parents[parents.length - 1] + var index = parent ? parent.children.indexOf(node) : null + return visitor(node, index, parent) + } +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/license b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/license new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/remark-preset-lint-consistent/node_modules/unist-util-visit/package.json b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/package.json new file mode 100644 index 00000000..ed51aa9a --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/package.json @@ -0,0 +1,150 @@ +{ + "_from": "unist-util-visit@^2.0.0", + "_id": "unist-util-visit@2.0.3", + "_inBundle": false, + "_integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==", + "_location": "/remark-preset-lint-consistent/unist-util-visit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-visit@^2.0.0", + "name": "unist-util-visit", + "escapedName": "unist-util-visit", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent/unified-message-control" + ], + "_resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz", + "_shasum": "c3703893146df47203bb8a9795af47d7b971208c", + "_spec": "unist-util-visit@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-visit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + }, + { + "name": "Richard Gibson", + "email": "richard.gibson@gmail.com" + } + ], + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-is": "^4.0.0", + "unist-util-visit-parents": "^3.0.0" + }, + "deprecated": false, + "description": "unist utility to visit nodes", + "devDependencies": { + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark": "^12.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^2.0.0", + "typescript": "^3.0.0", + "unified": "^9.0.0", + "xo": "^0.32.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-visit#readme", + "keywords": [ + "unist", + "unist-util", + "util", + "utility", + "remark", + "retext", + "rehype", + "mdast", + "hast", + "xast", + "nlcst", + "natural", + "language", + "markdown", + "html", + "xml", + "tree", + "ast", + "node", + "visit", + "walk" + ], + "license": "MIT", + "name": "unist-util-visit", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-visit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilVisit > unist-util-visit.js", + "build-mangle": "browserify . -s unistUtilVisit -p tinyify > unist-util-visit.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "2.0.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-set-has": "off" + }, + "ignores": [ + "unist-util-visit.js", + "types" + ] + } +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/readme.md new file mode 100644 index 00000000..60464ce4 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/readme.md @@ -0,0 +1,136 @@ +# unist-util-visit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to visit nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-visit +``` + +## Use + +```js +var u = require('unist-builder') +var visit = require('unist-util-visit') + +var tree = u('tree', [ + u('leaf', '1'), + u('node', [u('leaf', '2')]), + u('void'), + u('leaf', '3') +]) + +visit(tree, 'leaf', function(node) { + console.log(node) +}) +``` + +Yields: + +```js +{ type: 'leaf', value: '1' } +{ type: 'leaf', value: '2' } +{ type: 'leaf', value: '3' } +``` + +## API + +### `visit(tree[, test], visitor[, reverse])` + +This function works exactly the same as [`unist-util-visit-parents`][vp], +but `visitor` has a different signature. + +#### `next? = visitor(node, index, parent)` + +Instead of being passed an array of ancestors, `visitor` is invoked with the +node’s [`index`][index] and its [`parent`][parent]. + +Otherwise the same as [`unist-util-visit-parents`][vp]. + +## Related + +* [`unist-util-visit-parents`][vp] + — Like `visit`, but with a stack of parents +* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter) + — Create a new tree with all nodes that pass a test +* [`unist-util-map`](https://github.com/syntax-tree/unist-util-map) + — Create a new tree with all nodes mapped by a given function +* [`unist-util-flatmap`](https://gitlab.com/staltz/unist-util-flatmap) + — Create a new tree by mapping (to an array) with the given function +* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove) + — Remove nodes from a tree that pass a test +* [`unist-util-select`](https://github.com/syntax-tree/unist-util-select) + — Select nodes with CSS-like selectors + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-visit.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-visit + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-visit.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-visit + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-visit.svg + +[downloads]: https://www.npmjs.com/package/unist-util-visit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-visit.svg + +[size]: https://bundlephobia.com/result?p=unist-util-visit + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[vp]: https://github.com/syntax-tree/unist-util-visit-parents + +[index]: https://github.com/syntax-tree/unist#index + +[parent]: https://github.com/syntax-tree/unist#parent-1 diff --git a/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/types/index.d.ts b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/types/index.d.ts new file mode 100644 index 00000000..75e23ec9 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/unist-util-visit/types/index.d.ts @@ -0,0 +1,88 @@ +// TypeScript Version: 3.5 + +import {Node, Parent} from 'unist' +import {Test} from 'unist-util-is' +import { + Action, + ActionTuple, + Continue, + Exit, + Index, + Skip +} from 'unist-util-visit-parents' + +declare namespace visit { + /** + * Invoked when a node (matching test, if given) is found. + * Visitors are free to transform node. + * They can also transform the parent of node. + * Replacing node itself, if visit.SKIP is not returned, still causes its descendants to be visited. + * If adding or removing previous siblings (or next siblings, in case of reverse) of node, + * visitor should return a new index (number) to specify the sibling to traverse after node is traversed. + * Adding or removing next siblings of node (or previous siblings, in case of reverse) + * is handled as expected without needing to return a new index. + * Removing the children property of the parent still result in them being traversed. + * + * @param node Found node + * @param index Position of found node within Parent + * @param parent Parent of found node + * @paramType V node type found + * @returns + * When Action is passed, treated as a tuple of [Action] + * When Index is passed, treated as a tuple of [CONTINUE, Index] + * When ActionTuple is passed, + * Note that passing a tuple only makes sense if the action is SKIP. + * If the action is EXIT, that action can be returned. + * If the action is CONTINUE, index can be returned. + */ + type Visitor = ( + node: V, + index: number, + parent: Parent | undefined + ) => void | Action | Index | ActionTuple +} + +declare const visit: { + /** + * Visit children of tree which pass a test + * + * @param tree abstract syntax tree to visit + * @param test test node + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + * @typeParam T tree node + * @typeParam V node type found + */ + ( + tree: Node, + test: Test | Array>, + visitor: visit.Visitor, + reverse?: boolean + ): void + + /** + * Visit children of a tree + * + * @param tree abstract syntax tree to visit + * @param visitor function to run for each node + * @param reverse visit the tree in reverse, defaults to false + */ + (tree: Node, visitor: visit.Visitor, reverse?: boolean): void + + /** + * Continue traversing as normal + */ + CONTINUE: Continue + + /** + * Do not traverse this node’s children + */ + SKIP: Skip + + /** + * Stop traversing immediately + */ + EXIT: Exit +} + +export = visit diff --git a/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/index.js b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/index.js new file mode 100644 index 00000000..b7b74dd0 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/index.js @@ -0,0 +1,76 @@ +'use strict' + +module.exports = factory + +function factory(file) { + var contents = indices(String(file)) + var toPoint = offsetToPointFactory(contents) + + return { + toPoint: toPoint, + toPosition: toPoint, + toOffset: pointToOffsetFactory(contents) + } +} + +// Factory to get the line and column-based `point` for `offset` in the bound +// indices. +function offsetToPointFactory(indices) { + return offsetToPoint + + // Get the line and column-based `point` for `offset` in the bound indices. + function offsetToPoint(offset) { + var index = -1 + var length = indices.length + + if (offset < 0) { + return {} + } + + while (++index < length) { + if (indices[index] > offset) { + return { + line: index + 1, + column: offset - (indices[index - 1] || 0) + 1, + offset: offset + } + } + } + + return {} + } +} + +// Factory to get the `offset` for a line and column-based `point` in the +// bound indices. +function pointToOffsetFactory(indices) { + return pointToOffset + + // Get the `offset` for a line and column-based `point` in the bound + // indices. + function pointToOffset(point) { + var line = point && point.line + var column = point && point.column + + if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { + return (indices[line - 2] || 0) + column - 1 || 0 + } + + return -1 + } +} + +// Get indices of line-breaks in `value`. +function indices(value) { + var result = [] + var index = value.indexOf('\n') + + while (index !== -1) { + result.push(index + 1) + index = value.indexOf('\n', index + 1) + } + + result.push(value.length + 1) + + return result +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/license b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/remark-preset-lint-consistent/node_modules/vfile-location/package.json b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/package.json new file mode 100644 index 00000000..60c67e10 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/package.json @@ -0,0 +1,129 @@ +{ + "_from": "vfile-location@^3.0.0", + "_id": "vfile-location@3.1.0", + "_inBundle": false, + "_integrity": "sha512-FCZ4AN9xMcjFIG1oGmZKo61PjwJHRVA+0/tPUP2ul4uIwjGGndIxavEMRpWn5p4xwm/ZsdXp9YNygf1ZyE4x8g==", + "_location": "/remark-preset-lint-consistent/vfile-location", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "vfile-location@^3.0.0", + "name": "vfile-location", + "escapedName": "vfile-location", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-consistent/unified-message-control" + ], + "_resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.1.0.tgz", + "_shasum": "81cd8a04b0ac935185f4fce16f270503fc2f692f", + "_spec": "vfile-location@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-consistent/node_modules/unified-message-control", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/vfile/vfile-location/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "vfile utility to convert between positional (line and column-based) and offset (range-based) locations", + "devDependencies": { + "@types/unist": "^2.0.0", + "browserify": "^16.0.0", + "dtslint": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.0.0", + "remark-cli": "^8.0.0", + "remark-preset-wooorm": "^7.0.0", + "tape": "^5.0.0", + "tinyify": "^3.0.0", + "vfile": "^4.0.0", + "xo": "^0.33.0" + }, + "files": [ + "index.js", + "types/index.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/vfile/vfile-location#readme", + "keywords": [ + "vfile", + "vfile-util", + "util", + "utility", + "virtual", + "file", + "location", + "point", + "position", + "offset" + ], + "license": "MIT", + "name": "vfile-location", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vfile/vfile-location.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s vfileLocation > vfile-location.js", + "build-mangle": "browserify . -s vfileLocation -p tinyify > vfile-location.min.js", + "format": "remark . -qfo && prettier . --write && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage && npm run test-types", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js", + "test-types": "dtslint types" + }, + "types": "types/index.d.ts", + "version": "3.1.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-number-properties": "off" + }, + "ignores": [ + "vfile-location.js" + ] + } +} diff --git a/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/readme.md b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/readme.md new file mode 100644 index 00000000..ea7cd42f --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/readme.md @@ -0,0 +1,114 @@ +# vfile-location + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Convert between positional (line and column-based) and offsets (range-based) +locations in a [virtual file][vfile]. + +## Install + +[npm][]: + +```sh +npm install vfile-location +``` + +## Use + +```js +var vfile = require('vfile') +var vfileLocation = require('vfile-location') + +var location = vfileLocation(vfile('foo\nbar\nbaz')) + +var offset = location.toOffset({line: 3, column: 3}) // => 10 +location.toPoint(offset) // => {line: 3, column: 3, offset: 10} +``` + +## API + +### `location = vfileLocation(doc)` + +Get transform functions for the given `doc` (`string`) or [`file`][vfile]. + +Returns an object with [`toOffset`][to-offset] and [`toPoint`][to-point]. + +### `location.toOffset(point)` + +Get the `offset` (`number`) for a line and column-based [`point`][point] in the +bound file. +Returns `-1` when given invalid or out of bounds input. + +### `location.toPoint(offset)` + +Get the line and column-based [`point`][point] for `offset` in the bound file. + +## Contribute + +See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to +get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/vfile/vfile-location.svg + +[build]: https://travis-ci.org/vfile/vfile-location + +[coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile-location.svg + +[coverage]: https://codecov.io/github/vfile/vfile-location + +[downloads-badge]: https://img.shields.io/npm/dm/vfile-location.svg + +[downloads]: https://www.npmjs.com/package/vfile-location + +[size-badge]: https://img.shields.io/bundlephobia/minzip/vfile-location.svg + +[size]: https://bundlephobia.com/result?p=vfile-location + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/vfile/vfile/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[contributing]: https://github.com/vfile/.github/blob/HEAD/contributing.md + +[support]: https://github.com/vfile/.github/blob/HEAD/support.md + +[health]: https://github.com/vfile/.github + +[coc]: https://github.com/vfile/.github/blob/HEAD/code-of-conduct.md + +[license]: license + +[author]: https://wooorm.com + +[vfile]: https://github.com/vfile/vfile + +[to-offset]: #locationtooffsetpoint + +[to-point]: #locationtopointoffset + +[point]: https://github.com/syntax-tree/unist#point diff --git a/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/types/index.d.ts b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/types/index.d.ts new file mode 100644 index 00000000..ef5c6d01 --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/node_modules/vfile-location/types/index.d.ts @@ -0,0 +1,34 @@ +// TypeScript Version: 3.0 + +import {Point} from 'unist' +import {VFile} from 'vfile' + +declare namespace vfileLocation { + type PositionalPoint = Pick + type FullPoint = Required + type Offset = NonNullable + /** @deprecated */ + type Position = PositionalPoint + + interface Location { + /** + * Get the offset for a line and column based position in the bound file. + * Returns `-1` when given invalid or out of bounds input. + */ + toOffset: (point: PositionalPoint) => Offset + + /** + * Get the line and column-based point for offset in the bound file. + */ + toPoint: (offset: Offset) => FullPoint + /** @deprecated */ + toPosition: (offset: Offset) => FullPoint + } +} + +/** + * Get transform functions for the given `document`. + */ +declare function vfileLocation(document: string | VFile): vfileLocation.Location + +export = vfileLocation diff --git a/node_modules/remark-preset-lint-consistent/package.json b/node_modules/remark-preset-lint-consistent/package.json new file mode 100644 index 00000000..53b449ef --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/package.json @@ -0,0 +1,87 @@ +{ + "_from": "remark-preset-lint-consistent", + "_id": "remark-preset-lint-consistent@4.0.0", + "_inBundle": false, + "_integrity": "sha512-1euNZfRanM3wysHAR0vYX6uMbbKTlmTc+QvrymgRayKV8uhslQBISa+XduWk7mSz68ylS8CRR7JGvBfi6kDQjg==", + "_location": "/remark-preset-lint-consistent", + "_phantomChildren": { + "@types/unist": "2.0.3", + "mdast-comment-marker": "1.1.2", + "unified-lint-rule": "1.0.6", + "unist-util-generated": "1.1.5", + "unist-util-position": "3.1.0" + }, + "_requested": { + "type": "tag", + "registry": true, + "raw": "remark-preset-lint-consistent", + "name": "remark-preset-lint-consistent", + "escapedName": "remark-preset-lint-consistent", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/remark-preset-lint-consistent/-/remark-preset-lint-consistent-4.0.0.tgz", + "_shasum": "5686ac8477988834f40b514d9d805392eca6a103", + "_spec": "remark-preset-lint-consistent", + "_where": "/home/remi/github/CPP_BIDS", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "remark-lint": "^8.0.0", + "remark-lint-blockquote-indentation": "^2.0.0", + "remark-lint-checkbox-character-style": "^3.0.0", + "remark-lint-code-block-style": "^2.0.0", + "remark-lint-emphasis-marker": "^2.0.0", + "remark-lint-fenced-code-marker": "^2.0.0", + "remark-lint-heading-style": "^2.0.0", + "remark-lint-link-title-style": "^2.0.0", + "remark-lint-list-item-content-indent": "^2.0.0", + "remark-lint-ordered-list-marker-style": "^2.0.0", + "remark-lint-rule-style": "^2.0.0", + "remark-lint-strong-marker": "^2.0.0", + "remark-lint-table-cell-padding": "^3.0.0" + }, + "deprecated": false, + "description": "remark preset to configure remark-lint with rules that enforce consistency", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "remark-preset", + "preset", + "consistent", + "consistency" + ], + "license": "MIT", + "name": "remark-preset-lint-consistent", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent" + }, + "version": "4.0.0", + "xo": false +} diff --git a/node_modules/remark-preset-lint-consistent/readme.md b/node_modules/remark-preset-lint-consistent/readme.md new file mode 100644 index 00000000..3cbdbebe --- /dev/null +++ b/node_modules/remark-preset-lint-consistent/readme.md @@ -0,0 +1,126 @@ + + +# remark-preset-lint-consistent + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +remark preset to configure `remark-lint` with settings that enforce +consistency. + +## Rules + +This preset configures [`remark-lint`](https://github.com/remarkjs/remark-lint) with the following rules: + +| Rule | Setting | +| - | - | +| [`blockquote-indentation`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-blockquote-indentation) | `'consistent'` | +| [`checkbox-character-style`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-checkbox-character-style) | `'consistent'` | +| [`code-block-style`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-code-block-style) | `'consistent'` | +| [`emphasis-marker`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-emphasis-marker) | `'consistent'` | +| [`fenced-code-marker`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-marker) | `'consistent'` | +| [`heading-style`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-heading-style) | `'consistent'` | +| [`link-title-style`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-link-title-style) | `'consistent'` | +| [`list-item-content-indent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-content-indent) | | +| [`ordered-list-marker-style`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-ordered-list-marker-style) | `'consistent'` | +| [`rule-style`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-rule-style) | `'consistent'` | +| [`strong-marker`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-strong-marker) | `'consistent'` | +| [`table-cell-padding`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-table-cell-padding) | `'consistent'` | + +## Install + +[npm][]: + +```sh +npm install remark-preset-lint-consistent +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { ++ "plugins": ["preset-lint-consistent"] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u preset-lint-consistent readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() ++ .use(require('remark-preset-lint-consistent')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-preset-lint-consistent.svg + +[downloads]: https://www.npmjs.com/package/remark-preset-lint-consistent + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-preset-lint-consistent.svg + +[size]: https://bundlephobia.com/result?p=remark-preset-lint-consistent + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/remarkjs/remark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/index.js b/node_modules/remark-preset-lint-markdown-style-guide/index.js new file mode 100644 index 00000000..1862153f --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/index.js @@ -0,0 +1,235 @@ +/** + * @fileoverview + * remark preset to configure remark-lint with settings that the + * [Markdown Style Guide](http://www.cirosantilli.com/markdown-style-guide/). + * + * This uses the following Style Guide option system: `wrap:space`, + * `header:atx`, `list-marker:hyphen`, `list-space:mixed`, and + * `code:fenced`. + * + * ###### `space-sentence` + * + * Both `space-sentence:1` and `space-sentence:2` are not supported + * by `remark-lint`. You could set-up + * [`remark-retext`](https://github.com/remarkjs/remark-retext) with + * [`retext-sentence-spacing`](https://github.com/retextjs/retext-sentence-spacing) + * to check this though. + * + * ###### `wrap` + * + * `wrap:inner-sentence` and `wrap:sentence` are not supported by + * `remark-lint`. + * + * The default is `wrap:space`. To use `wrap:no`, turn off + * `remark-lint-maximum-line-length` like so: + * + * ```diff + * "plugins": [ + * ... + * "preset-lint-markdown-style-guide", + * + ["lint-maximum-line-length", false] + * ... + * ] + * ``` + * + * ###### `header` + * + * The default is `header:atx`. To use `header:setext`, change the + * setting for `remark-lint-heading-style` like so: + * + * ```diff + * "plugins": [ + * ... + * "preset-lint-markdown-style-guide", + * + ["lint-heading-style", "setext"] + * ... + * ] + * ``` + * + * ###### `list-marker` + * + * The default is `list-marker:hyphen`. For `list-marker:asterisk` or + * `list-marker:plus`, change the setting for + * `remark-lint-unordered-list-marker-style` like so: + * + * ```diff + * "plugins": [ + * ... + * "preset-lint-markdown-style-guide", + * + ["lint-unordered-list-marker-style", "*"] + * ... + * ] + * ``` + * + * ###### `list-space` + * + * The default is `list-space:mixed`. For `list-space:1`, change the + * setting for `remark-lint-list-item-indent` like so: + * + * ```diff + * "plugins": [ + * ... + * "preset-lint-markdown-style-guide", + * + ["lint-list-item-indent", "space"] + * ... + * ] + * ``` + * + * ###### `code` + * + * The default is `code:fenced`. For `code:indented`, change the setting + * for `remark-lint-code-block-style` like so: + * + * ```diff + * "plugins": [ + * ... + * "preset-lint-markdown-style-guide", + * + ["lint-code-block-style", "indented"] + * ... + * ] + * ``` + */ + +'use strict' + +module.exports.plugins = [ + require('remark-lint'), + + /* http://www.cirosantilli.com/markdown-style-guide/#file-extension */ + [require('remark-lint-file-extension'), 'md'], + + /* http://www.cirosantilli.com/markdown-style-guide/#file-name */ + require('remark-lint-no-file-name-mixed-case'), + require('remark-lint-no-file-name-articles'), + require('remark-lint-no-file-name-irregular-characters'), + require('remark-lint-no-file-name-consecutive-dashes'), + require('remark-lint-no-file-name-outer-dashes'), + + /* http://www.cirosantilli.com/markdown-style-guide/#newlines + * http://www.cirosantilli.com/markdown-style-guide/#empty-lines-around-lists + * http://www.cirosantilli.com/markdown-style-guide/#tables */ + require('remark-lint-no-consecutive-blank-lines'), + + /* http://www.cirosantilli.com/markdown-style-guide/#spaces-after-sentences. + * Not enforced, cannot be done properly without false positives, if you + * want this, use remark-retext and retext-sentence-spacing. */ + + /* http://www.cirosantilli.com/markdown-style-guide/#line-wrapping */ + [require('remark-lint-maximum-line-length'), 80], + + /* http://www.cirosantilli.com/markdown-style-guide/#dollar-signs-in-shell-code */ + require('remark-lint-no-shell-dollars'), + + /* http://www.cirosantilli.com/markdown-style-guide/#what-to-mark-as-code. + * This is a tip, not a rule. */ + + /* http://www.cirosantilli.com/markdown-style-guide/#spelling-and-grammar. + * Spelling is not in the scope of remark-lint. If you want this, + * use remark-retext and retext-spell. */ + + /* http://www.cirosantilli.com/markdown-style-guide/#line-breaks */ + require('remark-lint-hard-break-spaces'), + + /* http://www.cirosantilli.com/markdown-style-guide/#headers */ + [require('remark-lint-heading-style'), 'atx'], + require('remark-lint-heading-increment'), + require('remark-lint-no-duplicate-headings'), + + /* http://www.cirosantilli.com/markdown-style-guide/#top-level-header */ + require('remark-lint-no-multiple-toplevel-headings'), + + /* http://www.cirosantilli.com/markdown-style-guide/#header-case. + * heading case isn’t tested yet: new rules to fix this are ok though! */ + + /* http://www.cirosantilli.com/markdown-style-guide/#end-of-a-header. + * Cannot be checked? */ + + /* http://www.cirosantilli.com/markdown-style-guide/#header-length */ + require('remark-lint-maximum-heading-length'), + + /* http://www.cirosantilli.com/markdown-style-guide/#punctuation-at-the-end-of-headers */ + [require('remark-lint-no-heading-punctuation'), ':.'], + + /* http://www.cirosantilli.com/markdown-style-guide/#header-synonyms. + * Cannot be checked? */ + + /* http://www.cirosantilli.com/markdown-style-guide/#blockquotes */ + [require('remark-lint-blockquote-indentation'), 2], + require('remark-lint-no-blockquote-without-marker'), + + /* http://www.cirosantilli.com/markdown-style-guide/#unordered */ + [require('remark-lint-unordered-list-marker-style'), '-'], + + /* http://www.cirosantilli.com/markdown-style-guide/#ordered */ + [require('remark-lint-ordered-list-marker-style'), '.'], + [require('remark-lint-ordered-list-marker-value'), 'one'], + + /* http://www.cirosantilli.com/markdown-style-guide/#spaces-after-list-marker */ + [require('remark-lint-list-item-indent'), 'mixed'], + + /* http://www.cirosantilli.com/markdown-style-guide/#indentation-of-content-inside-lists */ + require('remark-lint-list-item-content-indent'), + + /* http://www.cirosantilli.com/markdown-style-guide/#empty-lines-inside-lists */ + require('remark-lint-list-item-spacing'), + + /* http://www.cirosantilli.com/markdown-style-guide/#case-of-first-letter-of-list-item. + * Not checked. */ + + /* http://www.cirosantilli.com/markdown-style-guide/#punctuation-at-the-end-of-list-items. + * Not checked. */ + + /* http://www.cirosantilli.com/markdown-style-guide/#definition-lists. + * Not checked. */ + + /* http://www.cirosantilli.com/markdown-style-guide/#code-blocks */ + [require('remark-lint-code-block-style'), 'fenced'], + [require('remark-lint-fenced-code-flag'), {allowEmpty: false}], + [require('remark-lint-fenced-code-marker'), '`'], + + /* http://www.cirosantilli.com/markdown-style-guide/#horizontal-rules */ + [require('remark-lint-rule-style'), '---'], + + /* http://www.cirosantilli.com/markdown-style-guide/#tables */ + require('remark-lint-no-table-indentation'), + require('remark-lint-table-pipes'), + require('remark-lint-table-pipe-alignment'), + [require('remark-lint-table-cell-padding'), 'padded'], + + /* http://www.cirosantilli.com/markdown-style-guide/#separate-consecutive-elements. + * Not checked. */ + + /* http://www.cirosantilli.com/markdown-style-guide/#span-elements */ + require('remark-lint-no-inline-padding'), + + /* http://www.cirosantilli.com/markdown-style-guide/#reference-style-links */ + require('remark-lint-no-shortcut-reference-image'), + require('remark-lint-no-shortcut-reference-link'), + require('remark-lint-final-definition'), + require('remark-lint-definition-case'), + require('remark-lint-definition-spacing'), + + /* http://www.cirosantilli.com/markdown-style-guide/#single-or-double-quote-titles */ + [require('remark-lint-link-title-style'), '"'], + + /* http://www.cirosantilli.com/markdown-style-guide/#bold */ + [require('remark-lint-strong-marker'), '*'], + + /* http://www.cirosantilli.com/markdown-style-guide/#italic */ + [require('remark-lint-emphasis-marker'), '*'], + + /* http://www.cirosantilli.com/markdown-style-guide/#uppercase-for-emphasis. + * Not checked. */ + + /* http://www.cirosantilli.com/markdown-style-guide/#emphasis-vs-headers */ + require('remark-lint-no-emphasis-as-heading'), + + /* http://www.cirosantilli.com/markdown-style-guide/#automatic-links-without-angle-brackets */ + require('remark-lint-no-literal-urls'), + + /* http://www.cirosantilli.com/markdown-style-guide/#content-of-automatic-links */ + require('remark-lint-no-auto-link-without-protocol') + + /* http://www.cirosantilli.com/markdown-style-guide/#email-automatic-links. + * Not checked. */ +] diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/index.js new file mode 100644 index 00000000..2b288487 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/index.js @@ -0,0 +1,105 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module blockquote-indentation + * @fileoverview + * Warn when block quotes are indented too much or too little. + * + * Options: `number` or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used indentation and will warn when + * other block quotes use a different indentation. + * + * @example {"name": "ok.md", "setting": 4} + * + * > Hello + * + * Paragraph. + * + * > World + * + * @example {"name": "ok.md", "setting": 2} + * + * > Hello + * + * Paragraph. + * + * > World + * + * @example {"name": "not-ok.md", "label": "input"} + * + * > Hello + * + * Paragraph. + * + * > World + * + * Paragraph. + * + * > World + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 5:3: Remove 1 space between block quote and content + * 9:3: Add 1 space between block quote and content + */ + +'use strict' + +var rule = require('unified-lint-rule') +var plural = require('plur') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') +var toString = require('mdast-util-to-string') + +module.exports = rule( + 'remark-lint:blockquote-indentation', + blockquoteIndentation +) + +function blockquoteIndentation(tree, file, option) { + var preferred = typeof option === 'number' && !isNaN(option) ? option : null + + visit(tree, 'blockquote', visitor) + + function visitor(node) { + var diff + var reason + + if (generated(node) || node.children.length === 0) { + return + } + + if (preferred) { + diff = preferred - check(node) + + if (diff !== 0) { + reason = + (diff > 0 ? 'Add' : 'Remove') + + ' ' + + Math.abs(diff) + + ' ' + + plural('space', diff) + + ' between block quote and content' + + file.message(reason, position.start(node.children[0])) + } + } else { + preferred = check(node) + } + } +} + +function check(node) { + var head = node.children[0] + var indentation = position.start(head).column - position.start(node).column + var padding = toString(head).match(/^ +/) + + if (padding) { + indentation += padding[0].length + } + + return indentation +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/package.json new file mode 100644 index 00000000..a41dfdfe --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-blockquote-indentation@^1.0.0", + "_id": "remark-lint-blockquote-indentation@1.0.4", + "_inBundle": false, + "_integrity": "sha512-ExcDP7lufshEBNkVddSHa+Bz/97PtFstIniQ8ZF2TahHPmpx92z3mkI/nXL2Qt5d3B09eTVvh4Pvhgp6x2470g==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-blockquote-indentation", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-blockquote-indentation@^1.0.0", + "name": "remark-lint-blockquote-indentation", + "escapedName": "remark-lint-blockquote-indentation", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-1.0.4.tgz", + "_shasum": "246b0bcf6ce83ed3eb3e306bba65d08e8cdeb5d2", + "_spec": "remark-lint-blockquote-indentation@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-to-string": "^1.0.2", + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when block quotes are either indented too much or too little", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "blockquote", + "indentation", + "indent" + ], + "license": "MIT", + "name": "remark-lint-blockquote-indentation", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-blockquote-indentation" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/readme.md new file mode 100644 index 00000000..7dcfcf5f --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-blockquote-indentation/readme.md @@ -0,0 +1,187 @@ + + +# remark-lint-blockquote-indentation + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when block quotes are indented too much or too little. + +Options: `number` or `'consistent'`, default: `'consistent'`. + +`'consistent'` detects the first used indentation and will warn when +other block quotes use a different indentation. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `2` | + +## Example + +##### `ok.md` + +When configured with `2`. + +###### In + +```markdown +> Hello + +Paragraph. + +> World +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `4`. + +###### In + +```markdown +> Hello + +Paragraph. + +> World +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +> Hello + +Paragraph. + +> World + +Paragraph. + +> World +``` + +###### Out + +```text +5:3: Remove 1 space between block quote and content +9:3: Add 1 space between block quote and content +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-blockquote-indentation +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-blockquote-indentation", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-blockquote-indentation readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-blockquote-indentation')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-blockquote-indentation.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-blockquote-indentation + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-blockquote-indentation.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-blockquote-indentation + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/index.js new file mode 100644 index 00000000..47592a50 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/index.js @@ -0,0 +1,149 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module code-block-style + * @fileoverview + * Warn when code blocks do not adhere to a given style. + * + * Options: `'consistent'`, `'fenced'`, or `'indented'`, default: `'consistent'`. + * + * `'consistent'` detects the first used code block style and warns when + * subsequent code blocks uses different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats code blocks using a fence if they have a language flag and + * indentation if not. + * Pass + * [`fences: true`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsfences) + * to always use fences for code blocks. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"setting": "indented", "name": "ok.md"} + * + * alpha(); + * + * Paragraph. + * + * bravo(); + * + * @example {"setting": "indented", "name": "not-ok.md", "label": "input"} + * + * ``` + * alpha(); + * ``` + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"setting": "indented", "name": "not-ok.md", "label": "output"} + * + * 1:1-3:4: Code blocks should be indented + * 7:1-9:4: Code blocks should be indented + * + * @example {"setting": "fenced", "name": "ok.md"} + * + * ``` + * alpha(); + * ``` + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"setting": "fenced", "name": "not-ok-fenced.md", "label": "input"} + * + * alpha(); + * + * Paragraph. + * + * bravo(); + * + * @example {"setting": "fenced", "name": "not-ok-fenced.md", "label": "output"} + * + * 1:1-1:13: Code blocks should be fenced + * 5:1-5:13: Code blocks should be fenced + * + * @example {"name": "not-ok-consistent.md", "label": "input"} + * + * alpha(); + * + * Paragraph. + * + * ``` + * bravo(); + * ``` + * + * @example {"name": "not-ok-consistent.md", "label": "output"} + * + * 5:1-7:4: Code blocks should be indented + * + * @example {"setting": "💩", "name": "not-ok-incorrect.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect code block style `💩`: use either `'consistent'`, `'fenced'`, or `'indented'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:code-block-style', codeBlockStyle) + +var start = position.start +var end = position.end + +var styles = {null: true, fenced: true, indented: true} + +function codeBlockStyle(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect code block style `' + + preferred + + "`: use either `'consistent'`, `'fenced'`, or `'indented'`" + ) + } + + visit(tree, 'code', visitor) + + function visitor(node) { + var initial + var final + var current + + if (generated(node)) { + return null + } + + initial = start(node).offset + final = end(node).offset + + current = + node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final)) + ? 'fenced' + : 'indented' + + if (preferred) { + if (preferred !== current) { + file.message('Code blocks should be ' + preferred, node) + } + } else { + preferred = current + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/package.json new file mode 100644 index 00000000..1a889fa7 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-code-block-style@^1.0.0", + "_id": "remark-lint-code-block-style@1.0.4", + "_inBundle": false, + "_integrity": "sha512-Wq5F94nkaWTx8W/9C/ydG+DhVWLirBrWb0xnoMQ0cHnizAd3BWw8g0x5L7yglMYSUSVLWY0jfMHgOe9UW3JfTw==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-code-block-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-code-block-style@^1.0.0", + "name": "remark-lint-code-block-style", + "escapedName": "remark-lint-code-block-style", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-1.0.4.tgz", + "_shasum": "c7d2fc493e4212e6c18a46b3396dae052bd223ad", + "_spec": "remark-lint-code-block-style@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when code blocks do not adhere to a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "code", + "block" + ], + "license": "MIT", + "name": "remark-lint-code-block-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-code-block-style" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/readme.md new file mode 100644 index 00000000..9fa6fb95 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-code-block-style/readme.md @@ -0,0 +1,256 @@ + + +# remark-lint-code-block-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when code blocks do not adhere to a given style. + +Options: `'consistent'`, `'fenced'`, or `'indented'`, default: `'consistent'`. + +`'consistent'` detects the first used code block style and warns when +subsequent code blocks uses different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +formats code blocks using a fence if they have a language flag and +indentation if not. +Pass +[`fences: true`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsfences) +to always use fences for code blocks. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'fenced'` | + +## Example + +##### `ok.md` + +When configured with `'indented'`. + +###### In + +```markdown + alpha(); + +Paragraph. + + bravo(); +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'indented'`. + +###### In + +````markdown +``` +alpha(); +``` + +Paragraph. + +``` +bravo(); +``` +```` + +###### Out + +```text +1:1-3:4: Code blocks should be indented +7:1-9:4: Code blocks should be indented +``` + +##### `ok.md` + +When configured with `'fenced'`. + +###### In + +````markdown +``` +alpha(); +``` + +Paragraph. + +``` +bravo(); +``` +```` + +###### Out + +No messages. + +##### `not-ok-fenced.md` + +When configured with `'fenced'`. + +###### In + +```markdown + alpha(); + +Paragraph. + + bravo(); +``` + +###### Out + +```text +1:1-1:13: Code blocks should be fenced +5:1-5:13: Code blocks should be fenced +``` + +##### `not-ok-consistent.md` + +###### In + +````markdown + alpha(); + +Paragraph. + +``` +bravo(); +``` +```` + +###### Out + +```text +5:1-7:4: Code blocks should be indented +``` + +##### `not-ok-incorrect.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect code block style `💩`: use either `'consistent'`, `'fenced'`, or `'indented'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-code-block-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-code-block-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-code-block-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-code-block-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-code-block-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-code-block-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-code-block-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-code-block-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/index.js new file mode 100644 index 00000000..997c84d8 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/index.js @@ -0,0 +1,107 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module emphasis-marker + * @fileoverview + * Warn for violating emphasis markers. + * + * Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + * + * `'consistent'` detects the first used emphasis style and warns when + * subsequent emphasis use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats emphasis using `_` (underscore) by default. + * Pass + * [`emphasis: '*'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsemphasis) + * to use `*` (asterisk) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"setting": "*", "name": "ok.md"} + * + * *foo* + * + * @example {"setting": "*", "name": "not-ok.md", "label": "input"} + * + * _foo_ + * + * @example {"setting": "*", "name": "not-ok.md", "label": "output"} + * + * 1:1-1:6: Emphasis should use `*` as a marker + * + * @example {"setting": "_", "name": "ok.md"} + * + * _foo_ + * + * @example {"setting": "_", "name": "not-ok.md", "label": "input"} + * + * *foo* + * + * @example {"setting": "_", "name": "not-ok.md", "label": "output"} + * + * 1:1-1:6: Emphasis should use `_` as a marker + * + * @example {"name": "not-ok.md", "label": "input"} + * + * *foo* + * _bar_ + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:1-2:6: Emphasis should use `*` as a marker + * + * @example {"setting": "💩", "name": "not-ok.md", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect emphasis marker `💩`: use either `'consistent'`, `'*'`, or `'_'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:emphasis-marker', emphasisMarker) + +var markers = {null: true, '*': true, _: true} + +function emphasisMarker(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (markers[preferred] !== true) { + file.fail( + 'Incorrect emphasis marker `' + + preferred + + "`: use either `'consistent'`, `'*'`, or `'_'`" + ) + } + + visit(tree, 'emphasis', visitor) + + function visitor(node) { + var marker + + if (!generated(node)) { + marker = contents.charAt(position.start(node).offset) + + if (preferred) { + if (marker !== preferred) { + file.message( + 'Emphasis should use `' + preferred + '` as a marker', + node + ) + } + } else { + preferred = marker + } + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/package.json new file mode 100644 index 00000000..bc6329ed --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/package.json @@ -0,0 +1,72 @@ +{ + "_from": "remark-lint-emphasis-marker@^1.0.0", + "_id": "remark-lint-emphasis-marker@1.0.4", + "_inBundle": false, + "_integrity": "sha512-TdYISSw7Ib6EJDApDj9zcZNDCJEaEoQIrYS3+QH2TQxoDx96B0t1bbErRM5L/hx1UWPBpeFLKpgIWL163eMmYA==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-emphasis-marker", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-emphasis-marker@^1.0.0", + "name": "remark-lint-emphasis-marker", + "escapedName": "remark-lint-emphasis-marker", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-emphasis-marker/-/remark-lint-emphasis-marker-1.0.4.tgz", + "_shasum": "86b5824a6d568726a8e5cb675ede92825e3297b7", + "_spec": "remark-lint-emphasis-marker@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when emphasis markers violate the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "emphasis", + "marker" + ], + "license": "MIT", + "name": "remark-lint-emphasis-marker", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-emphasis-marker" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/readme.md new file mode 100644 index 00000000..16417aae --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-emphasis-marker/readme.md @@ -0,0 +1,224 @@ + + +# remark-lint-emphasis-marker + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for violating emphasis markers. + +Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + +`'consistent'` detects the first used emphasis style and warns when +subsequent emphasis use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +formats emphasis using `_` (underscore) by default. +Pass +[`emphasis: '*'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsemphasis) +to use `*` (asterisk) instead. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'*'` | + +## Example + +##### `ok.md` + +When configured with `'*'`. + +###### In + +```markdown +*foo* +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'*'`. + +###### In + +```markdown +_foo_ +``` + +###### Out + +```text +1:1-1:6: Emphasis should use `*` as a marker +``` + +##### `ok.md` + +When configured with `'_'`. + +###### In + +```markdown +_foo_ +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'_'`. + +###### In + +```markdown +*foo* +``` + +###### Out + +```text +1:1-1:6: Emphasis should use `_` as a marker +``` + +##### `not-ok.md` + +###### In + +```markdown +*foo* +_bar_ +``` + +###### Out + +```text +2:1-2:6: Emphasis should use `*` as a marker +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect emphasis marker `💩`: use either `'consistent'`, `'*'`, or `'_'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-emphasis-marker +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-emphasis-marker", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-emphasis-marker readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-emphasis-marker')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-emphasis-marker.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-emphasis-marker + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-emphasis-marker.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-emphasis-marker + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/index.js new file mode 100644 index 00000000..ec3ce821 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/index.js @@ -0,0 +1,142 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module fenced-code-marker + * @fileoverview + * Warn for violating fenced code markers. + * + * Options: `` '`' ``, `'~'`, or `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used fenced code marker style and warns + * when subsequent fenced code blocks use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats fences using ``'`'`` (grave accent) by default. + * Pass + * [`fence: '~'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsfence) + * to use `~` (tilde) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * Indented code blocks are not affected by this rule: + * + * bravo(); + * + * @example {"name": "ok.md", "setting": "`"} + * + * ```alpha + * bravo(); + * ``` + * + * ``` + * charlie(); + * ``` + * + * @example {"name": "ok.md", "setting": "~"} + * + * ~~~alpha + * bravo(); + * ~~~ + * + * ~~~ + * charlie(); + * ~~~ + * + * @example {"name": "not-ok-consistent-tick.md", "label": "input"} + * + * ```alpha + * bravo(); + * ``` + * + * ~~~ + * charlie(); + * ~~~ + * + * @example {"name": "not-ok-consistent-tick.md", "label": "output"} + * + * 5:1-7:4: Fenced code should use `` ` `` as a marker + * + * @example {"name": "not-ok-consistent-tilde.md", "label": "input"} + * + * ~~~alpha + * bravo(); + * ~~~ + * + * ``` + * charlie(); + * ``` + * + * @example {"name": "not-ok-consistent-tilde.md", "label": "output"} + * + * 5:1-7:4: Fenced code should use `~` as a marker + * + * @example {"name": "not-ok-incorrect.md", "setting": "💩", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect fenced code marker `💩`: use either `'consistent'`, `` '`' ``, or `'~'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:fenced-code-marker', fencedCodeMarker) + +var markers = { + '`': true, + '~': true, + null: true +} + +function fencedCodeMarker(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (markers[preferred] !== true) { + file.fail( + 'Incorrect fenced code marker `' + + preferred + + "`: use either `'consistent'`, `` '`' ``, or `'~'`" + ) + } + + visit(tree, 'code', visitor) + + function visitor(node) { + var start + var marker + var label + + if (!generated(node)) { + start = position.start(node).offset + marker = contents + .slice(start, start + 4) + .replace(/^\s+/, '') + .charAt(0) + + // Ignore unfenced code blocks. + if (markers[marker] === true) { + if (preferred) { + if (marker !== preferred) { + label = preferred === '~' ? preferred : '` ` `' + file.message( + 'Fenced code should use `' + label + '` as a marker', + node + ) + } + } else { + preferred = marker + } + } + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/package.json new file mode 100644 index 00000000..83954001 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-fenced-code-marker@^1.0.0", + "_id": "remark-lint-fenced-code-marker@1.0.4", + "_inBundle": false, + "_integrity": "sha512-aJF4ISIEvK3NX+C2rN93QoS/32SSiytQKRSeGa+HwsAn3sTwqmy2IoAwbFeZIZA2vqKcVB4h1b9yKamSlfX30Q==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-fenced-code-marker", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-fenced-code-marker@^1.0.0", + "name": "remark-lint-fenced-code-marker", + "escapedName": "remark-lint-fenced-code-marker", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-1.0.4.tgz", + "_shasum": "80a6cc501c21435dad4a4ec635e6b3901b04fd2e", + "_spec": "remark-lint-fenced-code-marker@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when fenced code markers violate the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "fenced", + "code", + "marker" + ], + "license": "MIT", + "name": "remark-lint-fenced-code-marker", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-fenced-code-marker" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/readme.md new file mode 100644 index 00000000..ed1901dc --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-fenced-code-marker/readme.md @@ -0,0 +1,243 @@ + + +# remark-lint-fenced-code-marker + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for violating fenced code markers. + +Options: ``'`'``, `'~'`, or `'consistent'`, default: `'consistent'`. + +`'consistent'` detects the first used fenced code marker style and warns +when subsequent fenced code blocks use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +formats fences using ``'`'`` (grave accent) by default. +Pass +[`fence: '~'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsfence) +to use `~` (tilde) instead. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | ``'`'`` | + +## Example + +##### `ok.md` + +###### In + +```markdown +Indented code blocks are not affected by this rule: + + bravo(); +``` + +###### Out + +No messages. + +##### `not-ok-consistent-tick.md` + +###### In + +````markdown +```alpha +bravo(); +``` + +~~~ +charlie(); +~~~ +```` + +###### Out + +```text +5:1-7:4: Fenced code should use `` ` `` as a marker +``` + +##### `not-ok-consistent-tilde.md` + +###### In + +````markdown +~~~alpha +bravo(); +~~~ + +``` +charlie(); +``` +```` + +###### Out + +```text +5:1-7:4: Fenced code should use `~` as a marker +``` + +##### `ok.md` + +When configured with ``'`'``. + +###### In + +````markdown +```alpha +bravo(); +``` + +``` +charlie(); +``` +```` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'~'`. + +###### In + +```markdown +~~~alpha +bravo(); +~~~ + +~~~ +charlie(); +~~~ +``` + +###### Out + +No messages. + +##### `not-ok-incorrect.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect fenced code marker `💩`: use either `'consistent'`, `` '`' ``, or `'~'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-fenced-code-marker +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-fenced-code-marker", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-fenced-code-marker readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-fenced-code-marker')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-fenced-code-marker.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-fenced-code-marker + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-fenced-code-marker.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-fenced-code-marker + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/index.js new file mode 100644 index 00000000..bede011d --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/index.js @@ -0,0 +1,96 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module heading-style + * @fileoverview + * Warn when a heading does not conform to a given style. + * + * Options: `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'`, + * default: `'consistent'`. + * + * `'consistent'` detects the first used heading style and warns when + * subsequent headings use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats headings as ATX by default. + * This can be configured with the + * [`setext`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionssetext) + * and + * [`closeAtx`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionscloseatx) + * options. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "atx"} + * + * # Alpha + * + * ## Bravo + * + * ### Charlie + * + * @example {"name": "ok.md", "setting": "atx-closed"} + * + * # Delta ## + * + * ## Echo ## + * + * ### Foxtrot ### + * + * @example {"name": "ok.md", "setting": "setext"} + * + * Golf + * ==== + * + * Hotel + * ----- + * + * ### India + * + * @example {"name": "not-ok.md", "label": "input"} + * + * Juliett + * ======= + * + * ## Kilo + * + * ### Lima ### + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 4:1-4:8: Headings should use setext + * 6:1-6:13: Headings should use setext + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var style = require('mdast-util-heading-style') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:heading-style', headingStyle) + +var types = ['atx', 'atx-closed', 'setext'] + +function headingStyle(tree, file, option) { + var preferred = types.indexOf(option) === -1 ? null : option + + visit(tree, 'heading', visitor) + + function visitor(node) { + if (!generated(node)) { + if (preferred) { + if (style(node, preferred) !== preferred) { + file.message('Headings should use ' + preferred, node) + } + } else { + preferred = style(node, preferred) + } + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/package.json new file mode 100644 index 00000000..6d002fde --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/package.json @@ -0,0 +1,74 @@ +{ + "_from": "remark-lint-heading-style@^1.0.0", + "_id": "remark-lint-heading-style@1.0.4", + "_inBundle": false, + "_integrity": "sha512-ASssbw0vj9urTMxDJGpOn4K7d9MgPQPJGaCD+7v7je42krofvqC4CxpYvO/fOAkRZcttE91VfFHxkaPjiBtQLw==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-heading-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-heading-style@^1.0.0", + "name": "remark-lint-heading-style", + "escapedName": "remark-lint-heading-style", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-1.0.4.tgz", + "_shasum": "eee857c25da86c0e68473d3a61794886a7d06c37", + "_spec": "remark-lint-heading-style@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "mdast-util-heading-style": "^1.0.2", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when heading style violates the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "heading", + "style", + "atx", + "setext" + ], + "license": "MIT", + "name": "remark-lint-heading-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-heading-style" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/readme.md new file mode 100644 index 00000000..08b18f74 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-heading-style/readme.md @@ -0,0 +1,218 @@ + + +# remark-lint-heading-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when a heading does not conform to a given style. + +Options: `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'`, +default: `'consistent'`. + +`'consistent'` detects the first used heading style and warns when +subsequent headings use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +formats headings as ATX by default. +This can be configured with the +[`setext`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionssetext) +and +[`closeAtx`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionscloseatx) +options. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'atx'` | + +## Example + +##### `ok.md` + +When configured with `'atx'`. + +###### In + +```markdown +# Alpha + +## Bravo + +### Charlie +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'atx-closed'`. + +###### In + +```markdown +# Delta ## + +## Echo ## + +### Foxtrot ### +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'setext'`. + +###### In + +```markdown +Golf +==== + +Hotel +----- + +### India +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +Juliett +======= + +## Kilo + +### Lima ### +``` + +###### Out + +```text +4:1-4:8: Headings should use setext +6:1-6:13: Headings should use setext +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-heading-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-heading-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-heading-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-heading-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-heading-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-heading-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-heading-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-heading-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/index.js new file mode 100644 index 00000000..bc511446 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/index.js @@ -0,0 +1,195 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module link-title-style + * @fileoverview + * Warn when link and definition titles occur with incorrect quotes. + * + * Options: `'consistent'`, `'"'`, `'\''`, or `'()'`, default: `'consistent'`. + * + * `'consistent'` detects the first used quote style and warns when subsequent + * titles use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * uses `'` (single quote) for titles if they contain a double quote, and `"` + * (double quotes) otherwise. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "\""} + * + * [Example](http://example.com#without-title) + * [Example](http://example.com "Example Domain") + * ![Example](http://example.com "Example Domain") + * + * [Example]: http://example.com "Example Domain" + * + * You can use parens in URLs if they’re not a title (see GH-166): + * + * [Example](#Heading-(optional)) + * + * @example {"name": "not-ok.md", "label": "input", "setting": "\""} + * + * [Example]: http://example.com 'Example Domain' + * + * @example {"name": "not-ok.md", "label": "output", "setting": "\""} + * + * 1:31-1:47: Titles should use `"` as a quote + * + * @example {"name": "ok.md", "setting": "'"} + * + * [Example](http://example.com#without-title) + * [Example](http://example.com 'Example Domain') + * ![Example](http://example.com 'Example Domain') + * + * [Example]: http://example.com 'Example Domain' + * + * @example {"name": "not-ok.md", "label": "input", "setting": "'"} + * + * [Example]: http://example.com "Example Domain" + * + * @example {"name": "not-ok.md", "label": "output", "setting": "'"} + * + * 1:31-1:47: Titles should use `'` as a quote + * + * @example {"name": "ok.md", "setting": "()"} + * + * [Example](http://example.com#without-title) + * [Example](http://example.com (Example Domain)) + * ![Example](http://example.com (Example Domain)) + * + * [Example]: http://example.com (Example Domain) + * + * @example {"name": "not-ok.md", "label": "input", "setting": "()"} + * + * [Example](http://example.com 'Example Domain') + * + * @example {"name": "not-ok.md", "label": "output", "setting": "()"} + * + * 1:30-1:46: Titles should use `()` as a quote + * + * @example {"name": "not-ok.md", "label": "input"} + * + * [Example](http://example.com "Example Domain") + * [Example](http://example.com 'Example Domain') + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:30-2:46: Titles should use `"` as a quote + * + * @example {"name": "not-ok.md", "setting": "💩", "label": "output", "config": {"positionless": true}} + * + * 1:1: Incorrect link title style marker `💩`: use either `'consistent'`, `'"'`, `'\''`, or `'()'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var vfileLocation = require('vfile-location') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:link-title-style', linkTitleStyle) + +var own = {}.hasOwnProperty + +var start = position.start +var end = position.end + +var markers = { + '"': '"', + "'": "'", + ')': '(' +} + +function linkTitleStyle(tree, file, option) { + var contents = String(file) + var location = vfileLocation(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (preferred === '()' || preferred === '(') { + preferred = ')' + } + + if (preferred && !own.call(markers, preferred)) { + file.fail( + 'Incorrect link title style marker `' + + preferred + + "`: use either `'consistent'`, `'\"'`, `'\\''`, or `'()'`" + ) + } + + visit(tree, ['link', 'image', 'definition'], check) + + function check(node) { + var tail + var begin + var last + var first + var final + var initial + var reason + + if (generated(node)) { + return + } + + last = end(node).offset - 1 + tail = node.children ? node.children[node.children.length - 1] : null + begin = tail ? end(tail) : start(node) + + if (node.type !== 'definition') { + last-- + } + + // Skip back to before whitespace. + while (last) { + final = contents.charAt(last) + + /* istanbul ignore if - remark before 8.0.0 */ + if (/\s/.test(final)) { + last-- + } else { + break + } + } + + // Exit if the final marker is not a known marker. + if (!(final in markers)) { + return + } + + initial = markers[final] + + // Find the starting delimiter + first = contents.lastIndexOf(initial, last - 1) + + // Exit if there’s no starting delimiter, the starting delimiter is before + // the start of the node, or if it’s not preceded by whitespace. + if (first <= begin || !/\s/.test(contents.charAt(first - 1))) { + return + } + + if (preferred) { + if (preferred !== final) { + reason = + 'Titles should use `' + + (preferred === ')' ? '()' : preferred) + + '` as a quote' + + file.message(reason, { + start: location.toPosition(first), + end: location.toPosition(last + 1) + }) + } + } else { + preferred = final + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/package.json new file mode 100644 index 00000000..8ba07687 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-link-title-style@^1.0.0", + "_id": "remark-lint-link-title-style@1.0.5", + "_inBundle": false, + "_integrity": "sha512-Nu0cKj220q/PmUzELhYRUR2uxXabWuFJq9sApkgsc59uh+NKDtCEdpxkx7Zwvn6kUEwpuQVimeRfdesiKxX52g==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-link-title-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-link-title-style@^1.0.0", + "name": "remark-lint-link-title-style", + "escapedName": "remark-lint-link-title-style", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-link-title-style/-/remark-lint-link-title-style-1.0.5.tgz", + "_shasum": "55e098d1d1640ac2275efae8f3147a9b9b701744", + "_spec": "remark-lint-link-title-style@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1", + "vfile-location": "^2.0.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when link and definition titles occur with incorrect quotes", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "link", + "image", + "definition", + "style" + ], + "license": "MIT", + "name": "remark-lint-link-title-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-link-title-style" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/readme.md new file mode 100644 index 00000000..10de23a8 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-link-title-style/readme.md @@ -0,0 +1,268 @@ + + +# remark-lint-link-title-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when link and definition titles occur with incorrect quotes. + +Options: `'consistent'`, `'"'`, `'\''`, or `'()'`, default: `'consistent'`. + +`'consistent'` detects the first used quote style and warns when subsequent +titles use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +uses `'` (single quote) for titles if they contain a double quote, and `"` +(double quotes) otherwise. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'"'` | + +## Example + +##### `ok.md` + +When configured with `'"'`. + +###### In + +```markdown +[Example](http://example.com#without-title) +[Example](http://example.com "Example Domain") +![Example](http://example.com "Example Domain") + +[Example]: http://example.com "Example Domain" + +You can use parens in URLs if they’re not a title (see GH-166): + +[Example](#Heading-(optional)) +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'"'`. + +###### In + +```markdown +[Example]: http://example.com 'Example Domain' +``` + +###### Out + +```text +1:31-1:47: Titles should use `"` as a quote +``` + +##### `ok.md` + +When configured with `"'"`. + +###### In + +```markdown +[Example](http://example.com#without-title) +[Example](http://example.com 'Example Domain') +![Example](http://example.com 'Example Domain') + +[Example]: http://example.com 'Example Domain' +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `"'"`. + +###### In + +```markdown +[Example]: http://example.com "Example Domain" +``` + +###### Out + +```text +1:31-1:47: Titles should use `'` as a quote +``` + +##### `ok.md` + +When configured with `'()'`. + +###### In + +```markdown +[Example](http://example.com#without-title) +[Example](http://example.com (Example Domain)) +![Example](http://example.com (Example Domain)) + +[Example]: http://example.com (Example Domain) +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'()'`. + +###### In + +```markdown +[Example](http://example.com 'Example Domain') +``` + +###### Out + +```text +1:30-1:46: Titles should use `()` as a quote +``` + +##### `not-ok.md` + +###### In + +```markdown +[Example](http://example.com "Example Domain") +[Example](http://example.com 'Example Domain') +``` + +###### Out + +```text +2:30-2:46: Titles should use `"` as a quote +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect link title style marker `💩`: use either `'consistent'`, `'"'`, `'\''`, or `'()'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-link-title-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-link-title-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-link-title-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-link-title-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-link-title-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-link-title-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-link-title-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-link-title-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/index.js new file mode 100644 index 00000000..2bbb50f7 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/index.js @@ -0,0 +1,103 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module list-item-content-indent + * @fileoverview + * Warn when the content of a list item has mixed indentation. + * + * @example {"name": "ok.md"} + * + * 1.·[x] Alpha + * ···1. Bravo + * + * @example {"name": "not-ok.md", "label": "input"} + * + * 1.·[x] Charlie + * ····1. Delta + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 2:5: Don’t use mixed indentation for children, remove 1 space + */ + +'use strict' + +var rule = require('unified-lint-rule') +var plural = require('plur') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:list-item-content-indent', + listItemContentIndent +) + +var start = position.start + +function listItemContentIndent(tree, file) { + var contents = String(file) + + visit(tree, 'listItem', visitor) + + function visitor(node) { + var style + + node.children.forEach(visitItem) + + function visitItem(item, index) { + var begin + var column + var char + var diff + var reason + + if (generated(item)) { + return + } + + begin = start(item) + column = begin.column + + // Get indentation for the first child. Only the first item can have a + // checkbox, so here we remove that from the column. + if (index === 0) { + // If there’s a checkbox before the content, look backwards to find the + // start of that checkbox. + if (typeof node.checked === 'boolean') { + char = begin.offset - 1 + + while (contents.charAt(char) !== '[') { + char-- + } + + column -= begin.offset - char + } + + style = column + + return + } + + // Warn for violating children. + if (column !== style) { + diff = style - column + + reason = + 'Don’t use mixed indentation for children, ' + + /* istanbul ignore next - hard to test, I couldn’t find it at least. */ + (diff > 0 ? 'add' : 'remove') + + ' ' + + Math.abs(diff) + + ' ' + + plural('space', diff) + + file.message(reason, { + line: start(item).line, + column: column + }) + } + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/package.json new file mode 100644 index 00000000..b2a9f531 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/package.json @@ -0,0 +1,75 @@ +{ + "_from": "remark-lint-list-item-content-indent@^1.0.0", + "_id": "remark-lint-list-item-content-indent@1.0.4", + "_inBundle": false, + "_integrity": "sha512-zfEeAayZjEKkPr07fnhkGLENxOhnm0WZJTj6UBIXhtGu7rX23WNKSZaiou8iUoHxcO6ySCvIUJAEmq/XN1FxkQ==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-list-item-content-indent", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-list-item-content-indent@^1.0.0", + "name": "remark-lint-list-item-content-indent", + "escapedName": "remark-lint-list-item-content-indent", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-list-item-content-indent/-/remark-lint-list-item-content-indent-1.0.4.tgz", + "_shasum": "966640afa93d3e42377851bb47ac4c4d551b83f4", + "_spec": "remark-lint-list-item-content-indent@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "plur": "^3.0.0", + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when the content of a list item has mixed indentation", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "list", + "item", + "content", + "indent" + ], + "license": "MIT", + "name": "remark-lint-list-item-content-indent", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-content-indent" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/readme.md new file mode 100644 index 00000000..42512616 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-list-item-content-indent/readme.md @@ -0,0 +1,155 @@ + + +# remark-lint-list-item-content-indent + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the content of a list item has mixed indentation. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | + +## Example + +##### `ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +1.·[x] Alpha +···1. Bravo +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +Note: `·` represents a space. + +```markdown +1.·[x] Charlie +····1. Delta +``` + +###### Out + +```text +2:5: Don’t use mixed indentation for children, remove 1 space +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-list-item-content-indent +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-list-item-content-indent", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-list-item-content-indent readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-list-item-content-indent')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-list-item-content-indent.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-list-item-content-indent + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-list-item-content-indent.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-list-item-content-indent + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/index.js new file mode 100644 index 00000000..726052ce --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/index.js @@ -0,0 +1,117 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module ordered-list-marker-style + * @fileoverview + * Warn when the list item marker style of ordered lists violate a given style. + * + * Options: `'consistent'`, `'.'`, or `')'`, default: `'consistent'`. + * + * `'consistent'` detects the first used list style and warns when subsequent + * lists use different styles. + * + * Note: `)` is only supported in CommonMark. + * + * @example {"name": "ok.md"} + * + * 1. Foo + * + * + * 1. Bar + * + * Unordered lists are not affected by this rule. + * + * * Foo + * + * @example {"name": "ok.md", "setting": "."} + * + * 1. Foo + * + * 2. Bar + * + * @example {"name": "ok.md", "setting": ")", "config": {"commonmark": true}} + * + * + * + * 1) Foo + * + * 2) Bar + * + * @example {"name": "not-ok.md", "label": "input", "config": {"commonmark": true}} + * + * 1. Foo + * + * 2) Bar + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:8: Marker style should be `.` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:ordered-list-marker-style', + orderedListMarkerStyle +) + +var start = position.start + +var styles = { + ')': true, + '.': true, + null: true +} + +function orderedListMarkerStyle(tree, file, option) { + var contents = String(file) + var preferred = + typeof option !== 'string' || option === 'consistent' ? null : option + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect ordered list item marker style `' + + preferred + + "`: use either `'.'` or `')'`" + ) + } + + visit(tree, 'list', visitor) + + function visitor(node) { + var children = node.children + var length = node.ordered ? children.length : 0 + var index = -1 + var marker + var child + + while (++index < length) { + child = children[index] + + if (!generated(child)) { + marker = contents + .slice(start(child).offset, start(child.children[0]).offset) + .replace(/\s|\d/g, '') + .replace(/\[[x ]?]\s*$/i, '') + + if (preferred) { + if (marker !== preferred) { + file.message('Marker style should be `' + preferred + '`', child) + } + } else { + preferred = marker + } + } + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/package.json new file mode 100644 index 00000000..e6f1c69b --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-ordered-list-marker-style@^1.0.0", + "_id": "remark-lint-ordered-list-marker-style@1.0.4", + "_inBundle": false, + "_integrity": "sha512-c6AIqeePzm3nfkPCbTdwBS3/AQICgwE76+ryOc7tsSq4ulyK/Nt8Syvi/oiHYuonBddZoGtFTNCn0jqen9qscA==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-ordered-list-marker-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-ordered-list-marker-style@^1.0.0", + "name": "remark-lint-ordered-list-marker-style", + "escapedName": "remark-lint-ordered-list-marker-style", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-1.0.4.tgz", + "_shasum": "338f384094942389fd943af0523fdf639ccbf3d8", + "_spec": "remark-lint-ordered-list-marker-style@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when the markers of ordered lists violate a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "ordered", + "list", + "marker" + ], + "license": "MIT", + "name": "remark-lint-ordered-list-marker-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-style" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/readme.md new file mode 100644 index 00000000..ff9d5255 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-ordered-list-marker-style/readme.md @@ -0,0 +1,210 @@ + + +# remark-lint-ordered-list-marker-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the list item marker style of ordered lists violate a given style. + +Options: `'consistent'`, `'.'`, or `')'`, default: `'consistent'`. + +`'consistent'` detects the first used list style and warns when subsequent +lists use different styles. + +Note: `)` is only supported in CommonMark. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'.'` | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | `'.'` | + +## Example + +##### `ok.md` + +###### In + +```markdown +1. Foo + + +1. Bar + +Unordered lists are not affected by this rule. + +* Foo +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +1. Foo + +2) Bar +``` + +###### Out + +```text +3:1-3:8: Marker style should be `.` +``` + +##### `ok.md` + +When configured with `'.'`. + +###### In + +```markdown +1. Foo + +2. Bar +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `')'`. + +###### In + +```markdown + + +1) Foo + +2) Bar +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-ordered-list-marker-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-ordered-list-marker-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-ordered-list-marker-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-ordered-list-marker-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-ordered-list-marker-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-ordered-list-marker-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-ordered-list-marker-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-ordered-list-marker-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/index.js new file mode 100644 index 00000000..5f481173 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/index.js @@ -0,0 +1,100 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module rule-style + * @fileoverview + * Warn when the thematic breaks (horizontal rules) violate a given or + * detected style. + * + * Options: `string`, either a corect thematic breaks such as `***`, or + * `'consistent'`, default: `'consistent'`. + * + * `'consistent'` detects the first used thematic break style and warns when + * subsequent rules use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * has three settings that define how rules are created: + * + * * [`rule`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrule) + * (default: `*`) — Marker to use + * * [`ruleRepetition`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrulerepetition) + * (default: `3`) — Number of markers to use + * * [`ruleSpaces`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrulespaces) + * (default: `true`) — Whether to pad markers with spaces + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "* * *"} + * + * * * * + * + * * * * + * + * @example {"name": "ok.md", "setting": "_______"} + * + * _______ + * + * _______ + * + * @example {"name": "not-ok.md", "label": "input"} + * + * *** + * + * * * * + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:6: Rules should use `***` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:rule-style', ruleStyle) + +var start = position.start +var end = position.end + +function ruleStyle(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (preferred !== null && /[^-_* ]/.test(preferred)) { + file.fail( + "Incorrect preferred rule style: provide a correct markdown rule or `'consistent'`" + ) + } + + visit(tree, 'thematicBreak', visitor) + + function visitor(node) { + var initial = start(node).offset + var final = end(node).offset + var rule + + if (!generated(node)) { + rule = contents.slice(initial, final) + + if (preferred) { + if (rule !== preferred) { + file.message('Rules should use `' + preferred + '`', node) + } + } else { + preferred = rule + } + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/package.json new file mode 100644 index 00000000..ec7ad373 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-rule-style@^1.0.0", + "_id": "remark-lint-rule-style@1.0.4", + "_inBundle": false, + "_integrity": "sha512-omr5P6CCvo2zixCzK9uiGZpwzOE+4rc+95kWH95k2iA6Rp8Qohp8RK4unSRKLtFYGUhSbiQPgWaQXHDxMkWczg==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-rule-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-rule-style@^1.0.0", + "name": "remark-lint-rule-style", + "escapedName": "remark-lint-rule-style", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-1.0.4.tgz", + "_shasum": "16de7183711f9bcc96355e3f475f793090552b58", + "_spec": "remark-lint-rule-style@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when horizontal rules violate a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "horizontal", + "thematic", + "break" + ], + "license": "MIT", + "name": "remark-lint-rule-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-rule-style" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/readme.md new file mode 100644 index 00000000..0439f9b8 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-rule-style/readme.md @@ -0,0 +1,203 @@ + + +# remark-lint-rule-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the thematic breaks (horizontal rules) violate a given or +detected style. + +Options: `string`, either a corect thematic breaks such as `***`, or +`'consistent'`, default: `'consistent'`. + +`'consistent'` detects the first used thematic break style and warns when +subsequent rules use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +has three settings that define how rules are created: + +* [`rule`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrule) + (default: `*`) — Marker to use +* [`ruleRepetition`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrulerepetition) + (default: `3`) — Number of markers to use +* [`ruleSpaces`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsrulespaces) + (default: `true`) — Whether to pad markers with spaces + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'---'` | + +## Example + +##### `ok.md` + +When configured with `'* * *'`. + +###### In + +```markdown +* * * + +* * * +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'_______'`. + +###### In + +```markdown +_______ + +_______ +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +*** + +* * * +``` + +###### Out + +```text +3:1-3:6: Rules should use `***` +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-rule-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-rule-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-rule-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-rule-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-rule-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-rule-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-rule-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-rule-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/index.js new file mode 100644 index 00000000..c32c9171 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/index.js @@ -0,0 +1,96 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module strong-marker + * @fileoverview + * Warn for violating importance (strong) markers. + * + * Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + * + * `'consistent'` detects the first used importance style and warns when + * subsequent importance sequences use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats importance using an `*` (asterisk) by default. + * Pass + * [`strong: '_'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsstrong) + * to use `_` (underscore) instead. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md"} + * + * **foo** and **bar**. + * + * @example {"name": "also-ok.md"} + * + * __foo__ and __bar__. + * + * @example {"name": "ok.md", "setting": "*"} + * + * **foo**. + * + * @example {"name": "ok.md", "setting": "_"} + * + * __foo__. + * + * @example {"name": "not-ok.md", "label": "input"} + * + * **foo** and __bar__. + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 1:13-1:20: Strong should use `*` as a marker + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:strong-marker', strongMarker) + +var markers = {'*': true, _: true, null: true} + +function strongMarker(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (markers[preferred] !== true) { + file.fail( + 'Incorrect strong marker `' + + preferred + + "`: use either `'consistent'`, `'*'`, or `'_'`" + ) + } + + visit(tree, 'strong', visitor) + + function visitor(node) { + var marker = contents.charAt(position.start(node).offset) + + if (!generated(node)) { + if (preferred) { + if (marker !== preferred) { + file.message( + 'Strong should use `' + preferred + '` as a marker', + node + ) + } + } else { + preferred = marker + } + } + } +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/package.json new file mode 100644 index 00000000..83da7650 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-strong-marker@^1.0.0", + "_id": "remark-lint-strong-marker@1.0.4", + "_inBundle": false, + "_integrity": "sha512-X9f6yhZ85cdP0cmCgkqlbxllpeQ60pS9Qqk9Jb9SZo6f95esaHptQ5bExb1ZVXzhSHz2Xz86tUhXtzG3zGFD4g==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-strong-marker", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-strong-marker@^1.0.0", + "name": "remark-lint-strong-marker", + "escapedName": "remark-lint-strong-marker", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-1.0.4.tgz", + "_shasum": "7cef1bc8e9446f4f1d009555e42cc08bd30bddb4", + "_spec": "remark-lint-strong-marker@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when importance (strong) markers violate the given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "strong", + "marker", + "importance" + ], + "license": "MIT", + "name": "remark-lint-strong-marker", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-strong-marker" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/readme.md new file mode 100644 index 00000000..23881c34 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-strong-marker/readme.md @@ -0,0 +1,215 @@ + + +# remark-lint-strong-marker + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn for violating importance (strong) markers. + +Options: `'consistent'`, `'*'`, or `'_'`, default: `'consistent'`. + +`'consistent'` detects the first used importance style and warns when +subsequent importance sequences use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +formats importance using an `*` (asterisk) by default. +Pass +[`strong: '_'`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsstrong) +to use `_` (underscore) instead. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'*'` | + +## Example + +##### `ok.md` + +###### In + +```markdown +**foo** and **bar**. +``` + +###### Out + +No messages. + +##### `also-ok.md` + +###### In + +```markdown +__foo__ and __bar__. +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +**foo** and __bar__. +``` + +###### Out + +```text +1:13-1:20: Strong should use `*` as a marker +``` + +##### `ok.md` + +When configured with `'*'`. + +###### In + +```markdown +**foo**. +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'_'`. + +###### In + +```markdown +__foo__. +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-strong-marker +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-strong-marker", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-strong-marker readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-strong-marker')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-strong-marker.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-strong-marker + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-strong-marker.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-strong-marker + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/index.js b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/index.js new file mode 100644 index 00000000..8921ff52 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/index.js @@ -0,0 +1,295 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module table-cell-padding + * @fileoverview + * Warn when table cells are incorrectly padded. + * + * Options: `'consistent'`, `'padded'`, or `'compact'`, default: `'consistent'`. + * + * `'consistent'` detects the first used cell padding style and warns when + * subsequent cells use different styles. + * + * ## Fix + * + * [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) + * formats tables with padding by default. + * Pass + * [`spacedTable: false`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsspacedtable) + * to not use padding. + * + * See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) + * on how to automatically fix warnings for this rule. + * + * @example {"name": "ok.md", "setting": "padded"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * @example {"name": "not-ok.md", "label": "input", "setting": "padded"} + * + * | A | B | + * | :----|----: | + * | Alpha|Bravo | + * + * | C | D | + * | :----- | ---: | + * |Charlie | Delta| + * + * Too much padding isn’t good either: + * + * | E | F | G | H | + * | :---- | -------- | :----: | -----: | + * | Echo | Foxtrot | Golf | Hotel | + * + * @example {"name": "not-ok.md", "label": "output", "setting": "padded"} + * + * 3:8: Cell should be padded + * 3:9: Cell should be padded + * 7:2: Cell should be padded + * 7:17: Cell should be padded + * 13:23: Cell should be padded with 1 space, not 2 + * 13:32: Cell should be padded with 1 space, not 2 + * + * @example {"name": "ok.md", "setting": "compact"} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * @example {"name": "not-ok.md", "label": "input", "setting": "compact"} + * + * | A | B | + * | -----| -----| + * | Alpha| Bravo| + * + * |C | D| + * |:------|-----:| + * |Charlie|Delta | + * + * @example {"name": "not-ok.md", "label": "output", "setting": "compact"} + * + * 3:5: Cell should be compact + * 3:12: Cell should be compact + * 7:15: Cell should be compact + * + * @example {"name": "ok-padded.md", "setting": "consistent"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * | C | D | + * | ------- | ----- | + * | Charlie | Delta | + * + * @example {"name": "not-ok-padded.md", "label": "input", "setting": "consistent"} + * + * | A | B | + * | ----- | ----- | + * | Alpha | Bravo | + * + * | C | D | + * | :----- | ----: | + * |Charlie | Delta | + * + * @example {"name": "not-ok-padded.md", "label": "output", "setting": "consistent"} + * + * 7:2: Cell should be padded + * + * @example {"name": "ok-compact.md", "setting": "consistent"} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * |C |D | + * |-------|-----| + * |Charlie|Delta| + * + * @example {"name": "not-ok-compact.md", "label": "input", "setting": "consistent"} + * + * |A |B | + * |-----|-----| + * |Alpha|Bravo| + * + * |C | D| + * |:------|-----:| + * |Charlie|Delta | + * + * @example {"name": "not-ok-compact.md", "label": "output", "setting": "consistent"} + * + * 7:15: Cell should be compact + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'` + * + * @example {"name": "empty.md", "label": "input", "setting": "padded"} + * + * + * + * | | Alpha | Bravo| + * | ------ | ----- | ---: | + * | Charlie| | Echo| + * + * @example {"name": "empty.md", "label": "output", "setting": "padded"} + * + * 3:25: Cell should be padded + * 5:10: Cell should be padded + * 5:25: Cell should be padded + * + * @example {"name": "missing-body.md", "setting": "padded"} + * + * + * + * | Alpha | Bravo | Charlie | + * | ----- | -------- | ------- | + * | Delta | + * | Echo | Foxtrott | + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule('remark-lint:table-cell-padding', tableCellPadding) + +var start = position.start +var end = position.end + +var styles = {null: true, padded: true, compact: true} + +function tableCellPadding(tree, file, option) { + var contents = String(file) + var preferred = + typeof option === 'string' && option !== 'consistent' ? option : null + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect table cell padding style `' + + preferred + + "`, expected `'padded'`, `'compact'`, or `'consistent'`" + ) + } + + visit(tree, 'table', visitor) + + function visitor(node) { + var rows = node.children + var sizes = new Array(node.align.length) + var length = generated(node) ? -1 : rows.length + var index = -1 + var entries = [] + var style + var row + var cells + var column + var cellCount + var cell + var next + var fence + var pos + var entry + var final + + // Check rows. + while (++index < length) { + row = rows[index] + cells = row.children + cellCount = cells.length + column = -2 // Start without a first cell. + next = null + final = undefined + + // Check fences (before, between, and after cells). + while (++column < cellCount) { + cell = next + next = cells[column + 1] + + fence = contents.slice( + cell ? end(cell).offset : start(row).offset, + next ? start(next).offset : end(row).offset + ) + + pos = fence.indexOf('|') + + if (cell && cell.children.length !== 0 && final !== undefined) { + entries.push({node: cell, start: final, end: pos, index: column}) + + // Detect max space per column. + sizes[column] = Math.max(sizes[column] || 0, size(cell)) + } else { + final = undefined + } + + if (next && next.children.length !== 0) { + final = fence.length - pos - 1 + } else { + final = undefined + } + } + } + + if (preferred) { + style = preferred === 'padded' ? 1 : 0 + } else { + style = entries[0] && (!entries[0].start || !entries[0].end) ? 0 : 1 + } + + index = -1 + length = entries.length + + while (++index < length) { + entry = entries[index] + checkSide('start', entry, style, sizes) + checkSide('end', entry, style, sizes) + } + + return visit.SKIP + } + + function checkSide(side, entry, style, sizes) { + var cell = entry.node + var spacing = entry[side] + var index = entry.index + var reason + + if (spacing === undefined || spacing === style) { + return + } + + reason = 'Cell should be ' + + if (style === 0) { + reason += 'compact' + + // Ignore every cell except the biggest in the column. + if (size(cell) < sizes[index]) { + return + } + } else { + reason += 'padded' + + if (spacing > style) { + reason += ' with 1 space, not ' + spacing + + // May be right or center aligned. + if (size(cell) < sizes[index]) { + return + } + } + } + + file.message(reason, cell.position[side]) + } +} + +function size(node) { + return end(node).offset - start(node).offset +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/package.json b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/package.json new file mode 100644 index 00000000..c503691b --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-table-cell-padding@^1.0.0", + "_id": "remark-lint-table-cell-padding@1.0.5", + "_inBundle": false, + "_integrity": "sha512-N/WpcymrGBSPbLiv2OQTvdzNn6H9ctdyEA+P/odn4G9FqyrLmeTMkGJuGtinU569hLG/RtHqZIDeFVDiYi8Wzw==", + "_location": "/remark-preset-lint-markdown-style-guide/remark-lint-table-cell-padding", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-table-cell-padding@^1.0.0", + "name": "remark-lint-table-cell-padding", + "escapedName": "remark-lint-table-cell-padding", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-markdown-style-guide" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-1.0.5.tgz", + "_shasum": "0a533eaa60746a5976704ec9e6e49de311d67a95", + "_spec": "remark-lint-table-cell-padding@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-markdown-style-guide", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.4.0" + }, + "deprecated": false, + "description": "remark-lint rule to warn when table cells are incorrectly padded", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "table", + "cell", + "padding" + ], + "license": "MIT", + "name": "remark-lint-table-cell-padding", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-table-cell-padding" + }, + "version": "1.0.5", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/readme.md new file mode 100644 index 00000000..669bcd47 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/node_modules/remark-lint-table-cell-padding/readme.md @@ -0,0 +1,363 @@ + + +# remark-lint-table-cell-padding + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when table cells are incorrectly padded. + +Options: `'consistent'`, `'padded'`, or `'compact'`, default: `'consistent'`. + +`'consistent'` detects the first used cell padding style and warns when +subsequent cells use different styles. + +## Fix + +[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify) +formats tables with padding by default. +Pass +[`spacedTable: false`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#optionsspacedtable) +to not use padding. + +See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) +on how to automatically fix warnings for this rule. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'padded'` | + +## Example + +##### `ok.md` + +When configured with `'padded'`. + +###### In + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'padded'`. + +###### In + +```markdown +| A | B | +| :----|----: | +| Alpha|Bravo | + +| C | D | +| :----- | ---: | +|Charlie | Delta| + +Too much padding isn’t good either: + +| E | F | G | H | +| :---- | -------- | :----: | -----: | +| Echo | Foxtrot | Golf | Hotel | +``` + +###### Out + +```text +3:8: Cell should be padded +3:9: Cell should be padded +7:2: Cell should be padded +7:17: Cell should be padded +13:23: Cell should be padded with 1 space, not 2 +13:32: Cell should be padded with 1 space, not 2 +``` + +##### `empty.md` + +When configured with `'padded'`. + +###### In + +```markdown + + +| | Alpha | Bravo| +| ------ | ----- | ---: | +| Charlie| | Echo| +``` + +###### Out + +```text +3:25: Cell should be padded +5:10: Cell should be padded +5:25: Cell should be padded +``` + +##### `missing-body.md` + +When configured with `'padded'`. + +###### In + +```markdown + + +| Alpha | Bravo | Charlie | +| ----- | -------- | ------- | +| Delta | +| Echo | Foxtrott | +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `'compact'`. + +###### In + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'compact'`. + +###### In + +```markdown +| A | B | +| -----| -----| +| Alpha| Bravo| + +|C | D| +|:------|-----:| +|Charlie|Delta | +``` + +###### Out + +```text +3:5: Cell should be compact +3:12: Cell should be compact +7:15: Cell should be compact +``` + +##### `ok-padded.md` + +When configured with `'consistent'`. + +###### In + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | + +| C | D | +| ------- | ----- | +| Charlie | Delta | +``` + +###### Out + +No messages. + +##### `not-ok-padded.md` + +When configured with `'consistent'`. + +###### In + +```markdown +| A | B | +| ----- | ----- | +| Alpha | Bravo | + +| C | D | +| :----- | ----: | +|Charlie | Delta | +``` + +###### Out + +```text +7:2: Cell should be padded +``` + +##### `ok-compact.md` + +When configured with `'consistent'`. + +###### In + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| + +|C |D | +|-------|-----| +|Charlie|Delta| +``` + +###### Out + +No messages. + +##### `not-ok-compact.md` + +When configured with `'consistent'`. + +###### In + +```markdown +|A |B | +|-----|-----| +|Alpha|Bravo| + +|C | D| +|:------|-----:| +|Charlie|Delta | +``` + +###### Out + +```text +7:15: Cell should be compact +``` + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-table-cell-padding +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-table-cell-padding", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-table-cell-padding readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-table-cell-padding')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-table-cell-padding.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-table-cell-padding + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-table-cell-padding.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-table-cell-padding + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-markdown-style-guide/package.json b/node_modules/remark-preset-lint-markdown-style-guide/package.json new file mode 100644 index 00000000..67bd9ee5 --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/package.json @@ -0,0 +1,118 @@ +{ + "_from": "remark-preset-lint-markdown-style-guide@2.1.2", + "_id": "remark-preset-lint-markdown-style-guide@2.1.2", + "_inBundle": false, + "_integrity": "sha512-0mYeeO084o3ZuDSQCvj5vpMZEGQ/HxPcO5vdNpicu+wKpuGNKV2hYZeHbXa/uZV0gjiQeuRmCHIDgNaDsMj5fg==", + "_location": "/remark-preset-lint-markdown-style-guide", + "_phantomChildren": { + "mdast-util-heading-style": "1.0.6", + "mdast-util-to-string": "1.1.0", + "plur": "3.1.1", + "unified-lint-rule": "1.0.6", + "unist-util-generated": "1.1.5", + "unist-util-position": "3.1.0", + "unist-util-visit": "1.4.1", + "vfile-location": "2.0.6" + }, + "_requested": { + "type": "version", + "registry": true, + "raw": "remark-preset-lint-markdown-style-guide@2.1.2", + "name": "remark-preset-lint-markdown-style-guide", + "escapedName": "remark-preset-lint-markdown-style-guide", + "rawSpec": "2.1.2", + "saveSpec": null, + "fetchSpec": "2.1.2" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/remark-preset-lint-markdown-style-guide/-/remark-preset-lint-markdown-style-guide-2.1.2.tgz", + "_shasum": "a945814f4b014d3e6c0888fc034418bdfd77f44c", + "_spec": "remark-preset-lint-markdown-style-guide@2.1.2", + "_where": "/home/remi/github/CPP_BIDS", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "remark-lint": "^6.0.0", + "remark-lint-blockquote-indentation": "^1.0.0", + "remark-lint-code-block-style": "^1.0.0", + "remark-lint-definition-case": "^1.0.0", + "remark-lint-definition-spacing": "^1.0.0", + "remark-lint-emphasis-marker": "^1.0.0", + "remark-lint-fenced-code-flag": "^1.0.0", + "remark-lint-fenced-code-marker": "^1.0.0", + "remark-lint-file-extension": "^1.0.0", + "remark-lint-final-definition": "^1.0.0", + "remark-lint-hard-break-spaces": "^1.0.0", + "remark-lint-heading-increment": "^1.0.0", + "remark-lint-heading-style": "^1.0.0", + "remark-lint-link-title-style": "^1.0.0", + "remark-lint-list-item-content-indent": "^1.0.0", + "remark-lint-list-item-indent": "^1.0.0", + "remark-lint-list-item-spacing": "^1.0.0", + "remark-lint-maximum-heading-length": "^1.0.0", + "remark-lint-maximum-line-length": "^1.0.0", + "remark-lint-no-auto-link-without-protocol": "^1.0.0", + "remark-lint-no-blockquote-without-marker": "^2.0.0", + "remark-lint-no-consecutive-blank-lines": "^1.0.0", + "remark-lint-no-duplicate-headings": "^1.0.0", + "remark-lint-no-emphasis-as-heading": "^1.0.0", + "remark-lint-no-file-name-articles": "^1.0.0", + "remark-lint-no-file-name-consecutive-dashes": "^1.0.0", + "remark-lint-no-file-name-irregular-characters": "^1.0.0", + "remark-lint-no-file-name-mixed-case": "^1.0.0", + "remark-lint-no-file-name-outer-dashes": "^1.0.0", + "remark-lint-no-heading-punctuation": "^1.0.0", + "remark-lint-no-inline-padding": "^1.0.0", + "remark-lint-no-literal-urls": "^1.0.0", + "remark-lint-no-multiple-toplevel-headings": "^1.0.0", + "remark-lint-no-shell-dollars": "^1.0.0", + "remark-lint-no-shortcut-reference-image": "^1.0.0", + "remark-lint-no-shortcut-reference-link": "^1.0.0", + "remark-lint-no-table-indentation": "^1.0.0", + "remark-lint-ordered-list-marker-style": "^1.0.0", + "remark-lint-ordered-list-marker-value": "^1.0.0", + "remark-lint-rule-style": "^1.0.0", + "remark-lint-strong-marker": "^1.0.0", + "remark-lint-table-cell-padding": "^1.0.0", + "remark-lint-table-pipe-alignment": "^1.0.0", + "remark-lint-table-pipes": "^1.0.0", + "remark-lint-unordered-list-marker-style": "^1.0.0" + }, + "deprecated": false, + "description": "remark preset to configure remark-lint with rules that enforce the markdown style guide", + "files": [ + "index.js" + ], + "keywords": [ + "remark", + "preset", + "markdown", + "style", + "guide" + ], + "license": "MIT", + "name": "remark-preset-lint-markdown-style-guide", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide" + }, + "version": "2.1.2", + "xo": false +} diff --git a/node_modules/remark-preset-lint-markdown-style-guide/readme.md b/node_modules/remark-preset-lint-markdown-style-guide/readme.md new file mode 100644 index 00000000..4863290a --- /dev/null +++ b/node_modules/remark-preset-lint-markdown-style-guide/readme.md @@ -0,0 +1,186 @@ + + +# remark-preset-lint-markdown-style-guide + +remark preset to configure remark-lint with settings that the +[Markdown Style Guide](http://www.cirosantilli.com/markdown-style-guide/). + +This uses the following Style Guide option system: `wrap:space`, +`header:atx`, `list-marker:hyphen`, `list-space:mixed`, and +`code:fenced`. + +###### `space-sentence` + +Both `space-sentence:1` and `space-sentence:2` are not supported +by `remark-lint`. You could set-up +[`remark-retext`](https://github.com/remarkjs/remark-retext) with +[`retext-sentence-spacing`](https://github.com/retextjs/retext-sentence-spacing) +to check this though. + +###### `wrap` + +`wrap:inner-sentence` and `wrap:sentence` are not supported by +`remark-lint`. + +The default is `wrap:space`. To use `wrap:no`, turn off +`remark-lint-maximum-line-length` like so: + +```diff + "plugins": [ + ... + "preset-lint-markdown-style-guide", ++ ["lint-maximum-line-length", false] + ... + ] +``` + +###### `header` + +The default is `header:atx`. To use `header:setext`, change the +setting for `remark-lint-heading-style` like so: + +```diff + "plugins": [ + ... + "preset-lint-markdown-style-guide", ++ ["lint-heading-style", "setext"] + ... + ] +``` + +###### `list-marker` + +The default is `list-marker:hyphen`. For `list-marker:asterisk` or +`list-marker:plus`, change the setting for +`remark-lint-unordered-list-marker-style` like so: + +```diff + "plugins": [ + ... + "preset-lint-markdown-style-guide", ++ ["lint-unordered-list-marker-style", "*"] + ... + ] +``` + +###### `list-space` + +The default is `list-space:mixed`. For `list-space:1`, change the +setting for `remark-lint-list-item-indent` like so: + +```diff + "plugins": [ + ... + "preset-lint-markdown-style-guide", ++ ["lint-list-item-indent", "space"] + ... + ] +``` + +###### `code` + +The default is `code:fenced`. For `code:indented`, change the setting +for `remark-lint-code-block-style` like so: + +```diff + "plugins": [ + ... + "preset-lint-markdown-style-guide", ++ ["lint-code-block-style", "indented"] + ... + ] +``` + +## Rules + +This preset configures [`remark-lint`](https://github.com/remarkjs/remark-lint) with the following rules: + +| Rule | Setting | +| ---- | ------- | +| [`file-extension`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-file-extension) | `'md'` | +| [`no-file-name-mixed-case`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-file-name-mixed-case) | | +| [`no-file-name-articles`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-file-name-articles) | | +| [`no-file-name-irregular-characters`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-file-name-irregular-characters) | | +| [`no-file-name-consecutive-dashes`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-file-name-consecutive-dashes) | | +| [`no-file-name-outer-dashes`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-file-name-outer-dashes) | | +| [`no-consecutive-blank-lines`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-consecutive-blank-lines) | | +| [`maximum-line-length`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-maximum-line-length) | `80` | +| [`no-shell-dollars`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shell-dollars) | | +| [`hard-break-spaces`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-hard-break-spaces) | | +| [`heading-style`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-heading-style) | `'atx'` | +| [`heading-increment`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-heading-increment) | | +| [`no-duplicate-headings`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-duplicate-headings) | | +| [`no-multiple-toplevel-headings`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-multiple-toplevel-headings) | | +| [`maximum-heading-length`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-maximum-heading-length) | | +| [`no-heading-punctuation`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-heading-punctuation) | `':.'` | +| [`blockquote-indentation`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-blockquote-indentation) | `2` | +| [`no-blockquote-without-marker`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-blockquote-without-marker) | | +| [`unordered-list-marker-style`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-unordered-list-marker-style) | `'-'` | +| [`ordered-list-marker-style`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-style) | `'.'` | +| [`ordered-list-marker-value`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-value) | `'one'` | +| [`list-item-indent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-indent) | `'mixed'` | +| [`list-item-content-indent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-content-indent) | | +| [`list-item-spacing`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-spacing) | | +| [`code-block-style`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-code-block-style) | `'fenced'` | +| [`fenced-code-flag`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-fenced-code-flag) | `{allowEmpty: false}` | +| [`fenced-code-marker`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-fenced-code-marker) | ``'`'`` | +| [`rule-style`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-rule-style) | `'---'` | +| [`no-table-indentation`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-table-indentation) | | +| [`table-pipes`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-table-pipes) | | +| [`table-pipe-alignment`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-table-pipe-alignment) | | +| [`table-cell-padding`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-table-cell-padding) | `'padded'` | +| [`no-inline-padding`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-inline-padding) | | +| [`no-shortcut-reference-image`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shortcut-reference-image) | | +| [`no-shortcut-reference-link`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shortcut-reference-link) | | +| [`final-definition`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-final-definition) | | +| [`definition-case`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-definition-case) | | +| [`definition-spacing`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-definition-spacing) | | +| [`link-title-style`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-link-title-style) | `'"'` | +| [`strong-marker`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-strong-marker) | `'*'` | +| [`emphasis-marker`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-emphasis-marker) | `'*'` | +| [`no-emphasis-as-heading`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-emphasis-as-heading) | | +| [`no-literal-urls`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-literal-urls) | | +| [`no-auto-link-without-protocol`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-auto-link-without-protocol) | | + +## Install + +npm: + +```sh +npm install remark-preset-lint-markdown-style-guide +``` + +## Usage + +You probably want to use it on the CLI through a config file: + +```diff + ... + "remarkConfig": { ++ "plugins": ["preset-lint-markdown-style-guide"] + } + ... +``` + +Or use it on the CLI directly + +```sh +remark -u preset-lint-markdown-style-guide readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark'); + var report = require('vfile-reporter'); + + remark() ++ .use(require('remark-preset-lint-markdown-style-guide')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)); + }); +``` + +## License + +[MIT](https://github.com/remarkjs/remark-lint/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com) diff --git a/node_modules/remark-preset-lint-recommended/index.js b/node_modules/remark-preset-lint-recommended/index.js new file mode 100644 index 00000000..9ccb50f7 --- /dev/null +++ b/node_modules/remark-preset-lint-recommended/index.js @@ -0,0 +1,32 @@ +/** + * @fileoverview + * remark preset to configure remark-lint with settings that + * prevent mistakes or syntaxes that do not work correctly + * across vendors. + */ + +'use strict' + +module.exports.plugins = [ + require('remark-lint'), + /* Unix compatibility. */ + require('remark-lint-final-newline'), + /* Rendering across vendors differs greatly + * if using other styles. */ + require('remark-lint-list-item-bullet-indent'), + [require('remark-lint-list-item-indent'), 'tab-size'], + /* Differs or unsupported across vendors. */ + require('remark-lint-no-auto-link-without-protocol'), + require('remark-lint-no-blockquote-without-marker'), + require('remark-lint-no-literal-urls'), + [require('remark-lint-ordered-list-marker-style'), '.'], + /* Mistakes. */ + require('remark-lint-hard-break-spaces'), + require('remark-lint-no-duplicate-definitions'), + require('remark-lint-no-heading-content-indent'), + require('remark-lint-no-inline-padding'), + require('remark-lint-no-shortcut-reference-image'), + require('remark-lint-no-shortcut-reference-link'), + require('remark-lint-no-undefined-references'), + require('remark-lint-no-unused-definitions') +] diff --git a/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/index.js b/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/index.js new file mode 100644 index 00000000..726052ce --- /dev/null +++ b/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/index.js @@ -0,0 +1,117 @@ +/** + * @author Titus Wormer + * @copyright 2015 Titus Wormer + * @license MIT + * @module ordered-list-marker-style + * @fileoverview + * Warn when the list item marker style of ordered lists violate a given style. + * + * Options: `'consistent'`, `'.'`, or `')'`, default: `'consistent'`. + * + * `'consistent'` detects the first used list style and warns when subsequent + * lists use different styles. + * + * Note: `)` is only supported in CommonMark. + * + * @example {"name": "ok.md"} + * + * 1. Foo + * + * + * 1. Bar + * + * Unordered lists are not affected by this rule. + * + * * Foo + * + * @example {"name": "ok.md", "setting": "."} + * + * 1. Foo + * + * 2. Bar + * + * @example {"name": "ok.md", "setting": ")", "config": {"commonmark": true}} + * + * + * + * 1) Foo + * + * 2) Bar + * + * @example {"name": "not-ok.md", "label": "input", "config": {"commonmark": true}} + * + * 1. Foo + * + * 2) Bar + * + * @example {"name": "not-ok.md", "label": "output"} + * + * 3:1-3:8: Marker style should be `.` + * + * @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} + * + * 1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'` + */ + +'use strict' + +var rule = require('unified-lint-rule') +var visit = require('unist-util-visit') +var position = require('unist-util-position') +var generated = require('unist-util-generated') + +module.exports = rule( + 'remark-lint:ordered-list-marker-style', + orderedListMarkerStyle +) + +var start = position.start + +var styles = { + ')': true, + '.': true, + null: true +} + +function orderedListMarkerStyle(tree, file, option) { + var contents = String(file) + var preferred = + typeof option !== 'string' || option === 'consistent' ? null : option + + if (styles[preferred] !== true) { + file.fail( + 'Incorrect ordered list item marker style `' + + preferred + + "`: use either `'.'` or `')'`" + ) + } + + visit(tree, 'list', visitor) + + function visitor(node) { + var children = node.children + var length = node.ordered ? children.length : 0 + var index = -1 + var marker + var child + + while (++index < length) { + child = children[index] + + if (!generated(child)) { + marker = contents + .slice(start(child).offset, start(child.children[0]).offset) + .replace(/\s|\d/g, '') + .replace(/\[[x ]?]\s*$/i, '') + + if (preferred) { + if (marker !== preferred) { + file.message('Marker style should be `' + preferred + '`', child) + } + } else { + preferred = marker + } + } + } + } +} diff --git a/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/package.json b/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/package.json new file mode 100644 index 00000000..e1446e4b --- /dev/null +++ b/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/package.json @@ -0,0 +1,73 @@ +{ + "_from": "remark-lint-ordered-list-marker-style@^1.0.0", + "_id": "remark-lint-ordered-list-marker-style@1.0.4", + "_inBundle": false, + "_integrity": "sha512-c6AIqeePzm3nfkPCbTdwBS3/AQICgwE76+ryOc7tsSq4ulyK/Nt8Syvi/oiHYuonBddZoGtFTNCn0jqen9qscA==", + "_location": "/remark-preset-lint-recommended/remark-lint-ordered-list-marker-style", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-lint-ordered-list-marker-style@^1.0.0", + "name": "remark-lint-ordered-list-marker-style", + "escapedName": "remark-lint-ordered-list-marker-style", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-preset-lint-recommended" + ], + "_resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-1.0.4.tgz", + "_shasum": "338f384094942389fd943af0523fdf639ccbf3d8", + "_spec": "remark-lint-ordered-list-marker-style@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-preset-lint-recommended", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "unified-lint-rule": "^1.0.0", + "unist-util-generated": "^1.1.0", + "unist-util-position": "^3.0.0", + "unist-util-visit": "^1.1.1" + }, + "deprecated": false, + "description": "remark-lint rule to warn when the markers of ordered lists violate a given style", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "remark", + "lint", + "rule", + "remark-lint-rule", + "ordered", + "list", + "marker" + ], + "license": "MIT", + "name": "remark-lint-ordered-list-marker-style", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-style" + }, + "version": "1.0.4", + "xo": false +} diff --git a/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/readme.md b/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/readme.md new file mode 100644 index 00000000..ff9d5255 --- /dev/null +++ b/node_modules/remark-preset-lint-recommended/node_modules/remark-lint-ordered-list-marker-style/readme.md @@ -0,0 +1,210 @@ + + +# remark-lint-ordered-list-marker-style + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +Warn when the list item marker style of ordered lists violate a given style. + +Options: `'consistent'`, `'.'`, or `')'`, default: `'consistent'`. + +`'consistent'` detects the first used list style and warns when subsequent +lists use different styles. + +Note: `)` is only supported in CommonMark. + +## Presets + +This rule is included in the following presets: + +| Preset | Setting | +| ------ | ------- | +| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-consistent) | `'consistent'` | +| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | `'.'` | +| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | `'.'` | + +## Example + +##### `ok.md` + +###### In + +```markdown +1. Foo + + +1. Bar + +Unordered lists are not affected by this rule. + +* Foo +``` + +###### Out + +No messages. + +##### `not-ok.md` + +###### In + +```markdown +1. Foo + +2) Bar +``` + +###### Out + +```text +3:1-3:8: Marker style should be `.` +``` + +##### `ok.md` + +When configured with `'.'`. + +###### In + +```markdown +1. Foo + +2. Bar +``` + +###### Out + +No messages. + +##### `ok.md` + +When configured with `')'`. + +###### In + +```markdown + + +1) Foo + +2) Bar +``` + +###### Out + +No messages. + +##### `not-ok.md` + +When configured with `'💩'`. + +###### Out + +```text +1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'` +``` + +## Install + +[npm][]: + +```sh +npm install remark-lint-ordered-list-marker-style +``` + +## Use + +You probably want to use it on the CLI through a config file: + +```diff + … + "remarkConfig": { + "plugins": [ + … + "lint", ++ "lint-ordered-list-marker-style", + … + ] + } + … +``` + +Or use it on the CLI directly + +```sh +remark -u lint -u lint-ordered-list-marker-style readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark') + var report = require('vfile-reporter') + + remark() + .use(require('remark-lint')) ++ .use(require('remark-lint-ordered-list-marker-style')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)) + }) +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/master.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-ordered-list-marker-style.svg + +[downloads]: https://www.npmjs.com/package/remark-lint-ordered-list-marker-style + +[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-ordered-list-marker-style.svg + +[size]: https://bundlephobia.com/result?p=remark-lint-ordered-list-marker-style + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/master/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/master/support.md + +[coc]: https://github.com/remarkjs/.github/blob/master/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/master/license + +[author]: https://wooorm.com diff --git a/node_modules/remark-preset-lint-recommended/package.json b/node_modules/remark-preset-lint-recommended/package.json new file mode 100644 index 00000000..130c287a --- /dev/null +++ b/node_modules/remark-preset-lint-recommended/package.json @@ -0,0 +1,83 @@ +{ + "_from": "remark-preset-lint-recommended@3.0.2", + "_id": "remark-preset-lint-recommended@3.0.2", + "_inBundle": false, + "_integrity": "sha512-os4YNWLbkorjvDHVB4o+zCCufZLzGoD4Iwdk7SV7bSIZurUTrMp/ZrpNytyetN9ugIMXuHbWJUE+dF0ND+WorQ==", + "_location": "/remark-preset-lint-recommended", + "_phantomChildren": { + "unified-lint-rule": "1.0.6", + "unist-util-generated": "1.1.5", + "unist-util-position": "3.1.0", + "unist-util-visit": "1.4.1" + }, + "_requested": { + "type": "version", + "registry": true, + "raw": "remark-preset-lint-recommended@3.0.2", + "name": "remark-preset-lint-recommended", + "escapedName": "remark-preset-lint-recommended", + "rawSpec": "3.0.2", + "saveSpec": null, + "fetchSpec": "3.0.2" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/remark-preset-lint-recommended/-/remark-preset-lint-recommended-3.0.2.tgz", + "_shasum": "5ce675678895ce7131326c12b6df9105a5d0632c", + "_spec": "remark-preset-lint-recommended@3.0.2", + "_where": "/home/remi/github/CPP_BIDS", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "remark-lint": "^6.0.0", + "remark-lint-final-newline": "^1.0.0", + "remark-lint-hard-break-spaces": "^1.0.0", + "remark-lint-list-item-bullet-indent": "^1.0.0", + "remark-lint-list-item-indent": "^1.0.0", + "remark-lint-no-auto-link-without-protocol": "^1.0.0", + "remark-lint-no-blockquote-without-marker": "^2.0.0", + "remark-lint-no-duplicate-definitions": "^1.0.0", + "remark-lint-no-heading-content-indent": "^1.0.0", + "remark-lint-no-inline-padding": "^1.0.0", + "remark-lint-no-literal-urls": "^1.0.0", + "remark-lint-no-shortcut-reference-image": "^1.0.0", + "remark-lint-no-shortcut-reference-link": "^1.0.0", + "remark-lint-no-undefined-references": "^1.0.0", + "remark-lint-no-unused-definitions": "^1.0.0", + "remark-lint-ordered-list-marker-style": "^1.0.0" + }, + "deprecated": false, + "description": "remark preset to configure remark-lint with rules that prevent mistakes or syntaxes that do not work correctly across vendors", + "files": [ + "index.js" + ], + "keywords": [ + "remark", + "preset", + "recommended" + ], + "license": "MIT", + "name": "remark-preset-lint-recommended", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended" + }, + "version": "3.0.2", + "xo": false +} diff --git a/node_modules/remark-preset-lint-recommended/readme.md b/node_modules/remark-preset-lint-recommended/readme.md new file mode 100644 index 00000000..394fc815 --- /dev/null +++ b/node_modules/remark-preset-lint-recommended/readme.md @@ -0,0 +1,72 @@ + + +# remark-preset-lint-recommended + +remark preset to configure remark-lint with settings that +prevent mistakes or syntaxes that do not work correctly +across vendors. + +## Rules + +This preset configures [`remark-lint`](https://github.com/remarkjs/remark-lint) with the following rules: + +| Rule | Setting | +| ---- | ------- | +| [`final-newline`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-final-newline) | | +| [`list-item-bullet-indent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-bullet-indent) | | +| [`list-item-indent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-list-item-indent) | `'tab-size'` | +| [`no-auto-link-without-protocol`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-auto-link-without-protocol) | | +| [`no-blockquote-without-marker`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-blockquote-without-marker) | | +| [`no-literal-urls`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-literal-urls) | | +| [`ordered-list-marker-style`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-ordered-list-marker-style) | `'.'` | +| [`hard-break-spaces`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-hard-break-spaces) | | +| [`no-duplicate-definitions`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-duplicate-definitions) | | +| [`no-heading-content-indent`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-heading-content-indent) | | +| [`no-inline-padding`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-inline-padding) | | +| [`no-shortcut-reference-image`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shortcut-reference-image) | | +| [`no-shortcut-reference-link`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shortcut-reference-link) | | +| [`no-undefined-references`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-undefined-references) | | +| [`no-unused-definitions`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-unused-definitions) | | + +## Install + +npm: + +```sh +npm install remark-preset-lint-recommended +``` + +## Usage + +You probably want to use it on the CLI through a config file: + +```diff + ... + "remarkConfig": { ++ "plugins": ["preset-lint-recommended"] + } + ... +``` + +Or use it on the CLI directly + +```sh +remark -u preset-lint-recommended readme.md +``` + +Or use this on the API: + +```diff + var remark = require('remark'); + var report = require('vfile-reporter'); + + remark() ++ .use(require('remark-preset-lint-recommended')) + .process('_Emphasis_ and **importance**', function (err, file) { + console.error(report(err || file)); + }); +``` + +## License + +[MIT](https://github.com/remarkjs/remark-lint/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com) diff --git a/node_modules/remark-stringify/index.js b/node_modules/remark-stringify/index.js new file mode 100644 index 00000000..23e64f2e --- /dev/null +++ b/node_modules/remark-stringify/index.js @@ -0,0 +1,14 @@ +'use strict'; + +var unherit = require('unherit'); +var xtend = require('xtend'); +var Compiler = require('./lib/compiler.js'); + +module.exports = stringify; +stringify.Compiler = Compiler; + +function stringify(options) { + var Local = unherit(Compiler); + Local.prototype.options = xtend(Local.prototype.options, this.data('settings'), options); + this.Compiler = Local; +} diff --git a/node_modules/remark-stringify/lib/compiler.js b/node_modules/remark-stringify/lib/compiler.js new file mode 100644 index 00000000..0afb486c --- /dev/null +++ b/node_modules/remark-stringify/lib/compiler.js @@ -0,0 +1,63 @@ +'use strict'; + +var xtend = require('xtend'); +var toggle = require('state-toggle'); + +module.exports = Compiler; + +/* Construct a new compiler. */ +function Compiler(tree, file) { + this.inLink = false; + this.inTable = false; + this.tree = tree; + this.file = file; + this.options = xtend(this.options); + this.setOptions({}); +} + +var proto = Compiler.prototype; + +/* Enter and exit helpers. */ +proto.enterLink = toggle('inLink', false); +proto.enterTable = toggle('inTable', false); +proto.enterLinkReference = require('./util/enter-link-reference'); + +/* Configuration. */ +proto.options = require('./defaults'); +proto.setOptions = require('./set-options'); + +proto.compile = require('./macro/compile'); +proto.visit = require('./macro/one'); +proto.all = require('./macro/all'); +proto.block = require('./macro/block'); +proto.visitOrderedItems = require('./macro/ordered-items'); +proto.visitUnorderedItems = require('./macro/unordered-items'); + +/* Expose visitors. */ +proto.visitors = { + root: require('./visitors/root'), + text: require('./visitors/text'), + heading: require('./visitors/heading'), + paragraph: require('./visitors/paragraph'), + blockquote: require('./visitors/blockquote'), + list: require('./visitors/list'), + listItem: require('./visitors/list-item'), + inlineCode: require('./visitors/inline-code'), + code: require('./visitors/code'), + html: require('./visitors/html'), + thematicBreak: require('./visitors/thematic-break'), + strong: require('./visitors/strong'), + emphasis: require('./visitors/emphasis'), + break: require('./visitors/break'), + delete: require('./visitors/delete'), + link: require('./visitors/link'), + linkReference: require('./visitors/link-reference'), + imageReference: require('./visitors/image-reference'), + definition: require('./visitors/definition'), + image: require('./visitors/image'), + footnote: require('./visitors/footnote'), + footnoteReference: require('./visitors/footnote-reference'), + footnoteDefinition: require('./visitors/footnote-definition'), + table: require('./visitors/table'), + tableCell: require('./visitors/table-cell') +}; diff --git a/node_modules/remark-stringify/lib/defaults.js b/node_modules/remark-stringify/lib/defaults.js new file mode 100644 index 00000000..5dcb72d3 --- /dev/null +++ b/node_modules/remark-stringify/lib/defaults.js @@ -0,0 +1,28 @@ +'use strict'; + +module.exports = { + gfm: true, + commonmark: false, + pedantic: false, + entities: 'false', + setext: false, + closeAtx: false, + looseTable: false, + spacedTable: true, + paddedTable: true, + stringLength: stringLength, + incrementListMarker: true, + fences: false, + fence: '`', + bullet: '-', + listItemIndent: 'tab', + rule: '*', + ruleSpaces: true, + ruleRepetition: 3, + strong: '*', + emphasis: '_' +}; + +function stringLength(value) { + return value.length; +} diff --git a/node_modules/remark-stringify/lib/escape.js b/node_modules/remark-stringify/lib/escape.js new file mode 100644 index 00000000..aeeaa3b1 --- /dev/null +++ b/node_modules/remark-stringify/lib/escape.js @@ -0,0 +1,247 @@ +'use strict'; + +var decimal = require('is-decimal'); +var alphanumeric = require('is-alphanumeric'); +var whitespace = require('is-whitespace-character'); +var escapes = require('markdown-escapes'); +var prefix = require('./util/entity-prefix-length'); + +module.exports = factory; + +var BACKSLASH = '\\'; +var BULLETS = ['*', '-', '+']; +var ALLIGNMENT = [':', '-', ' ', '|']; +var entities = {'<': '<', ':': ':', '&': '&', '|': '|', '~': '~'}; + +/* Factory to escape characters. */ +function factory(options) { + return escape; + + /* Escape punctuation characters in a node's value. */ + function escape(value, node, parent) { + var self = this; + var gfm = options.gfm; + var commonmark = options.commonmark; + var pedantic = options.pedantic; + var markers = commonmark ? ['.', ')'] : ['.']; + var siblings = parent && parent.children; + var index = siblings && siblings.indexOf(node); + var prev = siblings && siblings[index - 1]; + var next = siblings && siblings[index + 1]; + var length = value.length; + var escapable = escapes(options); + var position = -1; + var queue = []; + var escaped = queue; + var afterNewLine; + var character; + var wordCharBefore; + var wordCharAfter; + var offset; + var replace; + + if (prev) { + afterNewLine = text(prev) && /\n\s*$/.test(prev.value); + } else { + afterNewLine = !parent || parent.type === 'root' || parent.type === 'paragraph'; + } + + function one(character) { + return escapable.indexOf(character) === -1 ? + entities[character] : BACKSLASH + character; + } + + while (++position < length) { + character = value.charAt(position); + replace = false; + + if (character === '\n') { + afterNewLine = true; + } else if ( + character === BACKSLASH || + character === '`' || + character === '*' || + character === '[' || + character === '<' || + (character === '&' && prefix(value.slice(position)) > 0) || + (character === ']' && self.inLink) || + (gfm && character === '~' && value.charAt(position + 1) === '~') || + (gfm && character === '|' && (self.inTable || alignment(value, position))) || + ( + character === '_' && + /* Delegate leading/trailing underscores + * to the multinode version below. */ + position > 0 && + position < length - 1 && + ( + pedantic || + !alphanumeric(value.charAt(position - 1)) || + !alphanumeric(value.charAt(position + 1)) + ) + ) || + (gfm && !self.inLink && character === ':' && protocol(queue.join(''))) + ) { + replace = true; + } else if (afterNewLine) { + if ( + character === '>' || + character === '#' || + BULLETS.indexOf(character) !== -1 + ) { + replace = true; + } else if (decimal(character)) { + offset = position + 1; + + while (offset < length) { + if (!decimal(value.charAt(offset))) { + break; + } + + offset++; + } + + if (markers.indexOf(value.charAt(offset)) !== -1) { + next = value.charAt(offset + 1); + + if (!next || next === ' ' || next === '\t' || next === '\n') { + queue.push(value.slice(position, offset)); + position = offset; + character = value.charAt(position); + replace = true; + } + } + } + } + + if (afterNewLine && !whitespace(character)) { + afterNewLine = false; + } + + queue.push(replace ? one(character) : character); + } + + /* Multi-node versions. */ + if (siblings && text(node)) { + /* Check for an opening parentheses after a + * link-reference (which can be joined by + * white-space). */ + if (prev && prev.referenceType === 'shortcut') { + position = -1; + length = escaped.length; + + while (++position < length) { + character = escaped[position]; + + if (character === ' ' || character === '\t') { + continue; + } + + if (character === '(' || character === ':') { + escaped[position] = one(character); + } + + break; + } + + /* If the current node is all spaces / tabs, + * preceded by a shortcut, and followed by + * a text starting with `(`, escape it. */ + if ( + text(next) && + position === length && + next.value.charAt(0) === '(' + ) { + escaped.push(BACKSLASH); + } + } + + /* Ensure non-auto-links are not seen as links. + * This pattern needs to check the preceding + * nodes too. */ + if ( + gfm && + !self.inLink && + text(prev) && + value.charAt(0) === ':' && + protocol(prev.value.slice(-6)) + ) { + escaped[0] = one(':'); + } + + /* Escape ampersand if it would otherwise + * start an entity. */ + if ( + text(next) && + value.charAt(length - 1) === '&' && + prefix('&' + next.value) !== 0 + ) { + escaped[escaped.length - 1] = one('&'); + } + + /* Escape double tildes in GFM. */ + if ( + gfm && + text(next) && + value.charAt(length - 1) === '~' && + next.value.charAt(0) === '~' + ) { + escaped.splice(escaped.length - 1, 0, BACKSLASH); + } + + /* Escape underscores, but not mid-word (unless + * in pedantic mode). */ + wordCharBefore = text(prev) && alphanumeric(prev.value.slice(-1)); + wordCharAfter = text(next) && alphanumeric(next.value.charAt(0)); + + if (length === 1) { + if (value === '_' && (pedantic || !wordCharBefore || !wordCharAfter)) { + escaped.unshift(BACKSLASH); + } + } else { + if ( + value.charAt(0) === '_' && + (pedantic || !wordCharBefore || !alphanumeric(value.charAt(1))) + ) { + escaped.unshift(BACKSLASH); + } + + if ( + value.charAt(length - 1) === '_' && + (pedantic || !wordCharAfter || !alphanumeric(value.charAt(length - 2))) + ) { + escaped.splice(escaped.length - 1, 0, BACKSLASH); + } + } + } + + return escaped.join(''); + } +} + +/* Check if `index` in `value` is inside an alignment row. */ +function alignment(value, index) { + var start = value.lastIndexOf('\n', index); + var end = value.indexOf('\n', index); + + start = start === -1 ? -1 : start; + end = end === -1 ? value.length : end; + + while (++start < end) { + if (ALLIGNMENT.indexOf(value.charAt(start)) === -1) { + return false; + } + } + + return true; +} + +/* Check if `node` is a text node. */ +function text(node) { + return node && node.type === 'text'; +} + +/* Check if `value` ends in a protocol. */ +function protocol(value) { + var val = value.slice(-6).toLowerCase(); + return val === 'mailto' || val.slice(-5) === 'https' || val.slice(-4) === 'http'; +} diff --git a/node_modules/remark-stringify/lib/macro/all.js b/node_modules/remark-stringify/lib/macro/all.js new file mode 100644 index 00000000..4aa7adac --- /dev/null +++ b/node_modules/remark-stringify/lib/macro/all.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = all; + +/* Visit all children of `parent`. */ +function all(parent) { + var self = this; + var children = parent.children; + var length = children.length; + var results = []; + var index = -1; + + while (++index < length) { + results[index] = self.visit(children[index], parent); + } + + return results; +} diff --git a/node_modules/remark-stringify/lib/macro/block.js b/node_modules/remark-stringify/lib/macro/block.js new file mode 100644 index 00000000..7ee8f3d7 --- /dev/null +++ b/node_modules/remark-stringify/lib/macro/block.js @@ -0,0 +1,45 @@ +'use strict'; + +module.exports = block; + +/* Stringify a block node with block children (e.g., `root` + * or `blockquote`). + * Knows about code following a list, or adjacent lists + * with similar bullets, and places an extra newline + * between them. */ +function block(node) { + var self = this; + var values = []; + var children = node.children; + var length = children.length; + var index = -1; + var child; + var prev; + + while (++index < length) { + child = children[index]; + + if (prev) { + /* Duplicate nodes, such as a list + * directly following another list, + * often need multiple new lines. + * + * Additionally, code blocks following a list + * might easily be mistaken for a paragraph + * in the list itself. */ + if (child.type === prev.type && prev.type === 'list') { + values.push(prev.ordered === child.ordered ? '\n\n\n' : '\n\n'); + } else if (prev.type === 'list' && child.type === 'code' && !child.lang) { + values.push('\n\n\n'); + } else { + values.push('\n\n'); + } + } + + values.push(self.visit(child, node)); + + prev = child; + } + + return values.join(''); +} diff --git a/node_modules/remark-stringify/lib/macro/compile.js b/node_modules/remark-stringify/lib/macro/compile.js new file mode 100644 index 00000000..fef82f22 --- /dev/null +++ b/node_modules/remark-stringify/lib/macro/compile.js @@ -0,0 +1,10 @@ +'use strict'; + +var compact = require('mdast-util-compact'); + +module.exports = compile; + +/* Stringify the given tree. */ +function compile() { + return this.visit(compact(this.tree, this.options.commonmark)); +} diff --git a/node_modules/remark-stringify/lib/macro/one.js b/node_modules/remark-stringify/lib/macro/one.js new file mode 100644 index 00000000..f6a5d4a6 --- /dev/null +++ b/node_modules/remark-stringify/lib/macro/one.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = one; + +function one(node, parent) { + var self = this; + var visitors = self.visitors; + + /* Fail on unknown nodes. */ + if (typeof visitors[node.type] !== 'function') { + self.file.fail( + new Error( + 'Missing compiler for node of type `' + + node.type + '`: `' + node + '`' + ), + node + ); + } + + return visitors[node.type].call(self, node, parent); +} diff --git a/node_modules/remark-stringify/lib/macro/ordered-items.js b/node_modules/remark-stringify/lib/macro/ordered-items.js new file mode 100644 index 00000000..45f77760 --- /dev/null +++ b/node_modules/remark-stringify/lib/macro/ordered-items.js @@ -0,0 +1,37 @@ +'use strict'; + +module.exports = orderedItems; + +/* Visit ordered list items. + * + * Starts the list with + * `node.start` and increments each following list item + * bullet by one: + * + * 2. foo + * 3. bar + * + * In `incrementListMarker: false` mode, does not increment + * each marker and stays on `node.start`: + * + * 1. foo + * 1. bar + */ +function orderedItems(node) { + var self = this; + var fn = self.visitors.listItem; + var increment = self.options.incrementListMarker; + var values = []; + var start = node.start; + var children = node.children; + var length = children.length; + var index = -1; + var bullet; + + while (++index < length) { + bullet = (increment ? start + index : start) + '.'; + values[index] = fn.call(self, children[index], node, index, bullet); + } + + return values.join('\n'); +} diff --git a/node_modules/remark-stringify/lib/macro/unordered-items.js b/node_modules/remark-stringify/lib/macro/unordered-items.js new file mode 100644 index 00000000..020ca470 --- /dev/null +++ b/node_modules/remark-stringify/lib/macro/unordered-items.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = unorderedItems; + +/* Visit unordered list items. + * Uses `options.bullet` as each item's bullet. + */ +function unorderedItems(node) { + var self = this; + var bullet = self.options.bullet; + var fn = self.visitors.listItem; + var children = node.children; + var length = children.length; + var index = -1; + var values = []; + + while (++index < length) { + values[index] = fn.call(self, children[index], node, index, bullet); + } + + return values.join('\n'); +} diff --git a/node_modules/remark-stringify/lib/set-options.js b/node_modules/remark-stringify/lib/set-options.js new file mode 100644 index 00000000..8d873cae --- /dev/null +++ b/node_modules/remark-stringify/lib/set-options.js @@ -0,0 +1,168 @@ +'use strict'; + +var xtend = require('xtend'); +var encode = require('stringify-entities'); +var defaults = require('./defaults'); +var escapeFactory = require('./escape'); +var returner = require('./util/returner'); + +module.exports = setOptions; + +/* Map of applicable enum's. */ +var maps = { + entities: {true: true, false: true, numbers: true, escape: true}, + bullet: {'*': true, '-': true, '+': true}, + rule: {'-': true, _: true, '*': true}, + listItemIndent: {tab: true, mixed: true, 1: true}, + emphasis: {_: true, '*': true}, + strong: {_: true, '*': true}, + fence: {'`': true, '~': true} +}; + +/* Expose `validate`. */ +var validate = { + boolean: validateBoolean, + string: validateString, + number: validateNumber, + function: validateFunction +}; + +/* Set options. Does not overwrite previously set + * options. */ +function setOptions(options) { + var self = this; + var current = self.options; + var ruleRepetition; + var key; + + if (options == null) { + options = {}; + } else if (typeof options === 'object') { + options = xtend(options); + } else { + throw new Error('Invalid value `' + options + '` for setting `options`'); + } + + for (key in defaults) { + validate[typeof defaults[key]](options, key, current[key], maps[key]); + } + + ruleRepetition = options.ruleRepetition; + + if (ruleRepetition && ruleRepetition < 3) { + raise(ruleRepetition, 'options.ruleRepetition'); + } + + self.encode = encodeFactory(String(options.entities)); + self.escape = escapeFactory(options); + + self.options = options; + + return self; +} + +/* Throw an exception with in its `message` `value` + * and `name`. */ +function raise(value, name) { + throw new Error('Invalid value `' + value + '` for setting `' + name + '`'); +} + +/* Validate a value to be boolean. Defaults to `def`. + * Raises an exception with `context[name]` when not + * a boolean. */ +function validateBoolean(context, name, def) { + var value = context[name]; + + if (value == null) { + value = def; + } + + if (typeof value !== 'boolean') { + raise(value, 'options.' + name); + } + + context[name] = value; +} + +/* Validate a value to be boolean. Defaults to `def`. + * Raises an exception with `context[name]` when not + * a boolean. */ +function validateNumber(context, name, def) { + var value = context[name]; + + if (value == null) { + value = def; + } + + if (isNaN(value)) { + raise(value, 'options.' + name); + } + + context[name] = value; +} + +/* Validate a value to be in `map`. Defaults to `def`. + * Raises an exception with `context[name]` when not + * in `map`. */ +function validateString(context, name, def, map) { + var value = context[name]; + + if (value == null) { + value = def; + } + + value = String(value); + + if (!(value in map)) { + raise(value, 'options.' + name); + } + + context[name] = value; +} + +/* Validate a value to be function. Defaults to `def`. + * Raises an exception with `context[name]` when not + * a function. */ +function validateFunction(context, name, def) { + var value = context[name]; + + if (value == null) { + value = def; + } + + if (typeof value !== 'function') { + raise(value, 'options.' + name); + } + + context[name] = value; +} + +/* Factory to encode HTML entities. + * Creates a no-operation function when `type` is + * `'false'`, a function which encodes using named + * references when `type` is `'true'`, and a function + * which encodes using numbered references when `type` is + * `'numbers'`. */ +function encodeFactory(type) { + var options = {}; + + if (type === 'false') { + return returner; + } + + if (type === 'true') { + options.useNamedReferences = true; + } + + if (type === 'escape') { + options.escapeOnly = true; + options.useNamedReferences = true; + } + + return wrapped; + + /* Encode HTML entities using the bound options. */ + function wrapped(value) { + return encode(value, options); + } +} diff --git a/node_modules/remark-stringify/lib/util/copy-identifier-encoding.js b/node_modules/remark-stringify/lib/util/copy-identifier-encoding.js new file mode 100644 index 00000000..6cc014fe --- /dev/null +++ b/node_modules/remark-stringify/lib/util/copy-identifier-encoding.js @@ -0,0 +1,60 @@ +'use strict'; + +var entityPrefixLength = require('./entity-prefix-length'); + +module.exports = copy; + +var PUNCTUATION = /[-!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~_]/; + +/* For shortcut and collapsed reference links, the contents + * is also an identifier, so we need to restore the original + * encoding and escaping that were present in the source + * string. + * + * This function takes the unescaped & unencoded value from + * shortcut's child nodes and the identifier and encodes + * the former according to the latter. */ +function copy(value, identifier) { + var length = value.length; + var count = identifier.length; + var result = []; + var position = 0; + var index = 0; + var start; + + while (index < length) { + /* Take next non-punctuation characters from `value`. */ + start = index; + + while (index < length && !PUNCTUATION.test(value.charAt(index))) { + index += 1; + } + + result.push(value.slice(start, index)); + + /* Advance `position` to the next punctuation character. */ + while (position < count && !PUNCTUATION.test(identifier.charAt(position))) { + position += 1; + } + + /* Take next punctuation characters from `identifier`. */ + start = position; + + while (position < count && PUNCTUATION.test(identifier.charAt(position))) { + if (identifier.charAt(position) === '&') { + position += entityPrefixLength(identifier.slice(position)); + } + + position += 1; + } + + result.push(identifier.slice(start, position)); + + /* Advance `index` to the next non-punctuation character. */ + while (index < length && PUNCTUATION.test(value.charAt(index))) { + index += 1; + } + } + + return result.join(''); +} diff --git a/node_modules/remark-stringify/lib/util/enclose-title.js b/node_modules/remark-stringify/lib/util/enclose-title.js new file mode 100644 index 00000000..9e641b72 --- /dev/null +++ b/node_modules/remark-stringify/lib/util/enclose-title.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = enclose; + +/* There is currently no way to support nested delimiters + * across Markdown.pl, CommonMark, and GitHub (RedCarpet). + * The following code supports Markdown.pl and GitHub. + * CommonMark is not supported when mixing double- and + * single quotes inside a title. */ +function enclose(title) { + var delimiter = title.indexOf('"') === -1 ? '"' : '\''; + return delimiter + title + delimiter; +} diff --git a/node_modules/remark-stringify/lib/util/enclose-uri.js b/node_modules/remark-stringify/lib/util/enclose-uri.js new file mode 100644 index 00000000..9a53ae61 --- /dev/null +++ b/node_modules/remark-stringify/lib/util/enclose-uri.js @@ -0,0 +1,24 @@ +'use strict'; + +var count = require('ccount'); + +module.exports = enclose; + +var re = /\s/; + +/* Wrap `url` in angle brackets when needed, or when + * forced. + * In links, images, and definitions, the URL part needs + * to be enclosed when it: + * + * - has a length of `0`; + * - contains white-space; + * - has more or less opening than closing parentheses. + */ +function enclose(uri, always) { + if (always || uri.length === 0 || re.test(uri) || count(uri, '(') !== count(uri, ')')) { + return '<' + uri + '>'; + } + + return uri; +} diff --git a/node_modules/remark-stringify/lib/util/enter-link-reference.js b/node_modules/remark-stringify/lib/util/enter-link-reference.js new file mode 100644 index 00000000..a77053bc --- /dev/null +++ b/node_modules/remark-stringify/lib/util/enter-link-reference.js @@ -0,0 +1,36 @@ +'use strict'; + +var returner = require('./returner'); + +module.exports = enter; + +/* Shortcut and collapsed link references need no escaping + * and encoding during the processing of child nodes (it + * must be implied from identifier). + * + * This toggler turns encoding and escaping off for shortcut + * and collapsed references. + * + * Implies `enterLink`. + */ +function enter(compiler, node) { + var encode = compiler.encode; + var escape = compiler.escape; + var exit = compiler.enterLink(); + + if ( + node.referenceType !== 'shortcut' && + node.referenceType !== 'collapsed' + ) { + return exit; + } + + compiler.escape = returner; + compiler.encode = returner; + + return function () { + compiler.encode = encode; + compiler.escape = escape; + exit(); + }; +} diff --git a/node_modules/remark-stringify/lib/util/entity-prefix-length.js b/node_modules/remark-stringify/lib/util/entity-prefix-length.js new file mode 100644 index 00000000..488bb121 --- /dev/null +++ b/node_modules/remark-stringify/lib/util/entity-prefix-length.js @@ -0,0 +1,23 @@ +'use strict'; + +var decode = require('parse-entities'); + +module.exports = length; + +/* Returns the length of HTML entity that is a prefix of + * the given string (excluding the ampersand), 0 if it + * does not start with an entity. */ +function length(value) { + var prefix; + + /* istanbul ignore if - Currently also tested for at + * implemention, but we keep it here because that’s + * proper. */ + if (value.charAt(0) !== '&') { + return 0; + } + + prefix = value.split('&', 2).join('&'); + + return prefix.length - decode(prefix).length; +} diff --git a/node_modules/remark-stringify/lib/util/label.js b/node_modules/remark-stringify/lib/util/label.js new file mode 100644 index 00000000..bf6f5876 --- /dev/null +++ b/node_modules/remark-stringify/lib/util/label.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = label; + +/* Stringify a reference label. + * Because link references are easily, mistakingly, + * created (for example, `[foo]`), reference nodes have + * an extra property depicting how it looked in the + * original document, so stringification can cause minimal + * changes. */ +function label(node) { + var type = node.referenceType; + var value = type === 'full' ? node.identifier : ''; + + return type === 'shortcut' ? value : '[' + value + ']'; +} diff --git a/node_modules/remark-stringify/lib/util/pad.js b/node_modules/remark-stringify/lib/util/pad.js new file mode 100644 index 00000000..14b9b1b7 --- /dev/null +++ b/node_modules/remark-stringify/lib/util/pad.js @@ -0,0 +1,27 @@ +'use strict'; + +var repeat = require('repeat-string'); + +module.exports = pad; + +var INDENT = 4; + +/* Pad `value` with `level * INDENT` spaces. Respects + * lines. Ignores empty lines. */ +function pad(value, level) { + var index; + var padding; + + value = value.split('\n'); + + index = value.length; + padding = repeat(' ', level * INDENT); + + while (index--) { + if (value[index].length !== 0) { + value[index] = padding + value[index]; + } + } + + return value.join('\n'); +} diff --git a/node_modules/remark-stringify/lib/util/returner.js b/node_modules/remark-stringify/lib/util/returner.js new file mode 100644 index 00000000..09f674ac --- /dev/null +++ b/node_modules/remark-stringify/lib/util/returner.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = returner; + +function returner(value) { + return value; +} diff --git a/node_modules/remark-stringify/lib/visitors/blockquote.js b/node_modules/remark-stringify/lib/visitors/blockquote.js new file mode 100644 index 00000000..4f2c4a0a --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/blockquote.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = blockquote; + +function blockquote(node) { + var values = this.block(node).split('\n'); + var result = []; + var length = values.length; + var index = -1; + var value; + + while (++index < length) { + value = values[index]; + result[index] = (value ? ' ' : '') + value; + } + + return '>' + result.join('\n>'); +} diff --git a/node_modules/remark-stringify/lib/visitors/break.js b/node_modules/remark-stringify/lib/visitors/break.js new file mode 100644 index 00000000..5e6326ee --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/break.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = lineBreak; + +var map = {true: '\\\n', false: ' \n'}; + +function lineBreak() { + return map[this.options.commonmark]; +} diff --git a/node_modules/remark-stringify/lib/visitors/code.js b/node_modules/remark-stringify/lib/visitors/code.js new file mode 100644 index 00000000..c2aa1334 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/code.js @@ -0,0 +1,63 @@ +'use strict'; + +var streak = require('longest-streak'); +var repeat = require('repeat-string'); +var pad = require('../util/pad'); + +module.exports = code; + +/* Stringify code. + * Creates indented code when: + * + * - No language tag exists; + * - Not in `fences: true` mode; + * - A non-empty value exists. + * + * Otherwise, GFM fenced code is created: + * + * ```js + * foo(); + * ``` + * + * When in ``fence: `~` `` mode, uses tildes as fences: + * + * ~~~js + * foo(); + * ~~~ + * + * Knows about internal fences: + * + * ````markdown + * ```javascript + * foo(); + * ``` + * ```` + */ +function code(node, parent) { + var self = this; + var value = node.value; + var options = self.options; + var marker = options.fence; + var language = self.encode(node.lang || '', node); + var fence; + + /* Without (needed) fences. */ + if (!language && !options.fences && value) { + /* Throw when pedantic, in a list item which + * isn’t compiled using a tab. */ + if ( + parent && + parent.type === 'listItem' && + options.listItemIndent !== 'tab' && + options.pedantic + ) { + self.file.fail('Cannot indent code properly. See http://git.io/vgFvT', node.position); + } + + return pad(value, 1); + } + + fence = repeat(marker, Math.max(streak(value, marker) + 1, 3)); + + return fence + language + '\n' + value + '\n' + fence; +} diff --git a/node_modules/remark-stringify/lib/visitors/definition.js b/node_modules/remark-stringify/lib/visitors/definition.js new file mode 100644 index 00000000..0fc85556 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/definition.js @@ -0,0 +1,23 @@ +'use strict'; + +var uri = require('../util/enclose-uri'); +var title = require('../util/enclose-title'); + +module.exports = definition; + +/* Stringify an URL definition. + * + * Is smart about enclosing `url` (see `encloseURI()`) and + * `title` (see `encloseTitle()`). + * + * [foo]: 'An "example" e-mail' + */ +function definition(node) { + var content = uri(node.url); + + if (node.title) { + content += ' ' + title(node.title); + } + + return '[' + node.identifier + ']: ' + content; +} diff --git a/node_modules/remark-stringify/lib/visitors/delete.js b/node_modules/remark-stringify/lib/visitors/delete.js new file mode 100644 index 00000000..68fbedc5 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/delete.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = strikethrough; + +function strikethrough(node) { + return '~~' + this.all(node).join('') + '~~'; +} diff --git a/node_modules/remark-stringify/lib/visitors/emphasis.js b/node_modules/remark-stringify/lib/visitors/emphasis.js new file mode 100644 index 00000000..87f75b3a --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/emphasis.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = emphasis; + +/* Stringify an `emphasis`. + * + * The marker used is configurable through `emphasis`, which + * defaults to an underscore (`'_'`) but also accepts an + * asterisk (`'*'`): + * + * *foo* + */ +function emphasis(node) { + var marker = this.options.emphasis; + return marker + this.all(node).join('') + marker; +} diff --git a/node_modules/remark-stringify/lib/visitors/footnote-definition.js b/node_modules/remark-stringify/lib/visitors/footnote-definition.js new file mode 100644 index 00000000..158f98ed --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/footnote-definition.js @@ -0,0 +1,12 @@ +'use strict'; + +var repeat = require('repeat-string'); + +module.exports = footnoteDefinition; + +function footnoteDefinition(node) { + var id = node.identifier.toLowerCase(); + var content = this.all(node).join('\n\n' + repeat(' ', 4)); + + return '[^' + id + ']: ' + content; +} diff --git a/node_modules/remark-stringify/lib/visitors/footnote-reference.js b/node_modules/remark-stringify/lib/visitors/footnote-reference.js new file mode 100644 index 00000000..c6dccc4c --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/footnote-reference.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = footnoteReference; + +function footnoteReference(node) { + return '[^' + node.identifier + ']'; +} diff --git a/node_modules/remark-stringify/lib/visitors/footnote.js b/node_modules/remark-stringify/lib/visitors/footnote.js new file mode 100644 index 00000000..154e3580 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/footnote.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = footnote; + +function footnote(node) { + return '[^' + this.all(node).join('') + ']'; +} diff --git a/node_modules/remark-stringify/lib/visitors/heading.js b/node_modules/remark-stringify/lib/visitors/heading.js new file mode 100644 index 00000000..67789e22 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/heading.js @@ -0,0 +1,39 @@ +'use strict'; + +var repeat = require('repeat-string'); + +module.exports = heading; + +/* Stringify a heading. + * + * In `setext: true` mode and when `depth` is smaller than + * three, creates a setext header: + * + * Foo + * === + * + * Otherwise, an ATX header is generated: + * + * ### Foo + * + * In `closeAtx: true` mode, the header is closed with + * hashes: + * + * ### Foo ### + */ +function heading(node) { + var self = this; + var depth = node.depth; + var setext = self.options.setext; + var closeAtx = self.options.closeAtx; + var content = self.all(node).join(''); + var prefix; + + if (setext && depth < 3) { + return content + '\n' + repeat(depth === 1 ? '=' : '-', content.length); + } + + prefix = repeat('#', node.depth); + + return prefix + ' ' + content + (closeAtx ? ' ' + prefix : ''); +} diff --git a/node_modules/remark-stringify/lib/visitors/html.js b/node_modules/remark-stringify/lib/visitors/html.js new file mode 100644 index 00000000..e4990214 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/html.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = html; + +function html(node) { + return node.value; +} diff --git a/node_modules/remark-stringify/lib/visitors/image-reference.js b/node_modules/remark-stringify/lib/visitors/image-reference.js new file mode 100644 index 00000000..841558e0 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/image-reference.js @@ -0,0 +1,9 @@ +'use strict'; + +var label = require('../util/label'); + +module.exports = imageReference; + +function imageReference(node) { + return '![' + (this.encode(node.alt, node) || '') + ']' + label(node); +} diff --git a/node_modules/remark-stringify/lib/visitors/image.js b/node_modules/remark-stringify/lib/visitors/image.js new file mode 100644 index 00000000..f8adb0b9 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/image.js @@ -0,0 +1,31 @@ +'use strict'; + +var uri = require('../util/enclose-uri'); +var title = require('../util/enclose-title'); + +module.exports = image; + +/* Stringify an image. + * + * Is smart about enclosing `url` (see `encloseURI()`) and + * `title` (see `encloseTitle()`). + * + * ![foo]( 'My "favourite" icon') + * + * Supports named entities in `url`, `alt`, and `title` + * when in `settings.encode` mode. + */ +function image(node) { + var self = this; + var content = uri(self.encode(node.url || '', node)); + var exit = self.enterLink(); + var alt = self.encode(self.escape(node.alt || '', node)); + + exit(); + + if (node.title) { + content += ' ' + title(self.encode(node.title, node)); + } + + return '![' + alt + '](' + content + ')'; +} diff --git a/node_modules/remark-stringify/lib/visitors/inline-code.js b/node_modules/remark-stringify/lib/visitors/inline-code.js new file mode 100644 index 00000000..21666ba3 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/inline-code.js @@ -0,0 +1,35 @@ +'use strict'; + +var streak = require('longest-streak'); +var repeat = require('repeat-string'); + +module.exports = inlineCode; + +/* Stringify inline code. + * + * Knows about internal ticks (`\``), and ensures one more + * tick is used to enclose the inline code: + * + * ```foo ``bar`` baz``` + * + * Even knows about inital and final ticks: + * + * `` `foo `` + * `` foo` `` + */ +function inlineCode(node) { + var value = node.value; + var ticks = repeat('`', streak(value, '`') + 1); + var start = ticks; + var end = ticks; + + if (value.charAt(0) === '`') { + start += ' '; + } + + if (value.charAt(value.length - 1) === '`') { + end = ' ' + end; + } + + return start + value + end; +} diff --git a/node_modules/remark-stringify/lib/visitors/link-reference.js b/node_modules/remark-stringify/lib/visitors/link-reference.js new file mode 100644 index 00000000..a8e52a4d --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/link-reference.js @@ -0,0 +1,21 @@ +'use strict'; + +var copy = require('../util/copy-identifier-encoding'); +var label = require('../util/label'); + +module.exports = linkReference; + +function linkReference(node) { + var self = this; + var type = node.referenceType; + var exit = self.enterLinkReference(self, node); + var value = self.all(node).join(''); + + exit(); + + if (type === 'shortcut' || type === 'collapsed') { + value = copy(value, node.identifier); + } + + return '[' + value + ']' + label(node); +} diff --git a/node_modules/remark-stringify/lib/visitors/link.js b/node_modules/remark-stringify/lib/visitors/link.js new file mode 100644 index 00000000..7e435905 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/link.js @@ -0,0 +1,53 @@ +'use strict'; + +var uri = require('../util/enclose-uri'); +var title = require('../util/enclose-title'); + +module.exports = link; + +/* Expression for a protocol: + * http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax */ +var PROTOCOL = /^[a-z][a-z+.-]+:\/?/i; + +/* Stringify a link. + * + * When no title exists, the compiled `children` equal + * `url`, and `url` starts with a protocol, an auto + * link is created: + * + * + * + * Otherwise, is smart about enclosing `url` (see + * `encloseURI()`) and `title` (see `encloseTitle()`). + * + * [foo]( 'An "example" e-mail') + * + * Supports named entities in the `url` and `title` when + * in `settings.encode` mode. */ +function link(node) { + var self = this; + var content = self.encode(node.url || '', node); + var exit = self.enterLink(); + var escaped = self.encode(self.escape(node.url || '', node)); + var value = self.all(node).join(''); + + exit(); + + if ( + node.title == null && + PROTOCOL.test(content) && + (escaped === value || escaped === 'mailto:' + value) + ) { + /* Backslash escapes do not work in autolinks, + * so we do not escape. */ + return uri(self.encode(node.url), true); + } + + content = uri(content); + + if (node.title) { + content += ' ' + title(self.encode(self.escape(node.title, node), node)); + } + + return '[' + value + '](' + content + ')'; +} diff --git a/node_modules/remark-stringify/lib/visitors/list-item.js b/node_modules/remark-stringify/lib/visitors/list-item.js new file mode 100644 index 00000000..80787206 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/list-item.js @@ -0,0 +1,61 @@ +'use strict'; + +var repeat = require('repeat-string'); +var pad = require('../util/pad'); + +module.exports = listItem; + +/* Which checkbox to use. */ +var CHECKBOX_MAP = { + undefined: '', + null: '', + true: '[x] ', + false: '[ ] ' +}; + +/* Stringify a list item. + * + * Prefixes the content with a checked checkbox when + * `checked: true`: + * + * [x] foo + * + * Prefixes the content with an unchecked checkbox when + * `checked: false`: + * + * [ ] foo + */ +function listItem(node, parent, position, bullet) { + var self = this; + var style = self.options.listItemIndent; + var loose = node.loose; + var children = node.children; + var length = children.length; + var values = []; + var index = -1; + var value; + var indent; + var spacing; + + while (++index < length) { + values[index] = self.visit(children[index], node); + } + + value = CHECKBOX_MAP[node.checked] + values.join(loose ? '\n\n' : '\n'); + + if (style === '1' || (style === 'mixed' && value.indexOf('\n') === -1)) { + indent = bullet.length + 1; + spacing = ' '; + } else { + indent = Math.ceil((bullet.length + 1) / 4) * 4; + spacing = repeat(' ', indent - bullet.length); + } + + value = bullet + spacing + pad(value, indent / 4).slice(indent); + + if (loose && parent.children.length - 1 !== position) { + value += '\n'; + } + + return value; +} diff --git a/node_modules/remark-stringify/lib/visitors/list.js b/node_modules/remark-stringify/lib/visitors/list.js new file mode 100644 index 00000000..fde0bb90 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/list.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = list; + +/* Which method to use based on `list.ordered`. */ +var ORDERED_MAP = { + true: 'visitOrderedItems', + false: 'visitUnorderedItems' +}; + +function list(node) { + return this[ORDERED_MAP[node.ordered]](node); +} diff --git a/node_modules/remark-stringify/lib/visitors/paragraph.js b/node_modules/remark-stringify/lib/visitors/paragraph.js new file mode 100644 index 00000000..56a98458 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/paragraph.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = paragraph; + +function paragraph(node) { + return this.all(node).join(''); +} diff --git a/node_modules/remark-stringify/lib/visitors/root.js b/node_modules/remark-stringify/lib/visitors/root.js new file mode 100644 index 00000000..1ef1508c --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/root.js @@ -0,0 +1,9 @@ +'use strict'; + +module.exports = root; + +/* Stringify a root. + * Adds a final newline to ensure valid POSIX files. */ +function root(node) { + return this.block(node) + '\n'; +} diff --git a/node_modules/remark-stringify/lib/visitors/strong.js b/node_modules/remark-stringify/lib/visitors/strong.js new file mode 100644 index 00000000..18d5dd3d --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/strong.js @@ -0,0 +1,18 @@ +'use strict'; + +var repeat = require('repeat-string'); + +module.exports = strong; + +/* Stringify a `strong`. + * + * The marker used is configurable by `strong`, which + * defaults to an asterisk (`'*'`) but also accepts an + * underscore (`'_'`): + * + * __foo__ + */ +function strong(node) { + var marker = repeat(this.options.strong, 2); + return marker + this.all(node).join('') + marker; +} diff --git a/node_modules/remark-stringify/lib/visitors/table-cell.js b/node_modules/remark-stringify/lib/visitors/table-cell.js new file mode 100644 index 00000000..07e8ed60 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/table-cell.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = tableCell; + +function tableCell(node) { + return this.all(node).join(''); +} diff --git a/node_modules/remark-stringify/lib/visitors/table.js b/node_modules/remark-stringify/lib/visitors/table.js new file mode 100644 index 00000000..fc0c18c8 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/table.js @@ -0,0 +1,66 @@ +'use strict'; + +var markdownTable = require('markdown-table'); + +module.exports = table; + +/* Stringify table. + * + * Creates a fenced table by default, but not in + * `looseTable: true` mode: + * + * Foo | Bar + * :-: | --- + * Baz | Qux + * + * NOTE: Be careful with `looseTable: true` mode, as a + * loose table inside an indented code block on GitHub + * renders as an actual table! + * + * Creates a spaced table by default, but not in + * `spacedTable: false`: + * + * |Foo|Bar| + * |:-:|---| + * |Baz|Qux| + */ +function table(node) { + var self = this; + var options = self.options; + var loose = options.looseTable; + var spaced = options.spacedTable; + var pad = options.paddedTable; + var stringLength = options.stringLength; + var rows = node.children; + var index = rows.length; + var exit = self.enterTable(); + var result = []; + var start; + var end; + + while (index--) { + result[index] = self.all(rows[index]); + } + + exit(); + + if (loose) { + start = ''; + end = ''; + } else if (spaced) { + start = '| '; + end = ' |'; + } else { + start = '|'; + end = '|'; + } + + return markdownTable(result, { + align: node.align, + pad: pad, + start: start, + end: end, + stringLength: stringLength, + delimiter: spaced ? ' | ' : '|' + }); +} diff --git a/node_modules/remark-stringify/lib/visitors/text.js b/node_modules/remark-stringify/lib/visitors/text.js new file mode 100644 index 00000000..90fd7f96 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/text.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = text; + +/* Stringify text. + * Supports named entities in `settings.encode: true` mode: + * + * AT&T + * + * Supports numbered entities in `settings.encode: numbers` + * mode: + * + * AT&T + */ +function text(node, parent) { + return this.encode(this.escape(node.value, node, parent), node); +} diff --git a/node_modules/remark-stringify/lib/visitors/thematic-break.js b/node_modules/remark-stringify/lib/visitors/thematic-break.js new file mode 100644 index 00000000..329cfe39 --- /dev/null +++ b/node_modules/remark-stringify/lib/visitors/thematic-break.js @@ -0,0 +1,26 @@ +'use strict'; + +var repeat = require('repeat-string'); + +module.exports = thematic; + +/* Stringify a `thematic-break`. + * The character used is configurable through `rule`: (`'_'`) + * + * ___ + * + * The number of repititions is defined through + * `ruleRepetition`: (`6`) + * + * ****** + * + * Whether spaces delimit each character, is configured + * through `ruleSpaces`: (`true`) + * + * * * * + */ +function thematic() { + var options = this.options; + var rule = repeat(options.rule, options.ruleRepetition); + return options.ruleSpaces ? rule.split('').join(' ') : rule; +} diff --git a/node_modules/remark-stringify/package.json b/node_modules/remark-stringify/package.json new file mode 100644 index 00000000..001905fe --- /dev/null +++ b/node_modules/remark-stringify/package.json @@ -0,0 +1,84 @@ +{ + "_from": "remark-stringify@^5.0.0", + "_id": "remark-stringify@5.0.0", + "_inBundle": false, + "_integrity": "sha512-Ws5MdA69ftqQ/yhRF9XhVV29mhxbfGhbz0Rx5bQH+oJcNhhSM6nCu1EpLod+DjrFGrU0BMPs+czVmJZU7xiS7w==", + "_location": "/remark-stringify", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark-stringify@^5.0.0", + "name": "remark-stringify", + "escapedName": "remark-stringify", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/remark" + ], + "_resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-5.0.0.tgz", + "_shasum": "336d3a4d4a6a3390d933eeba62e8de4bd280afba", + "_spec": "remark-stringify@^5.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + { + "name": "Eugene Sharygin", + "email": "eush77@gmail.com" + } + ], + "dependencies": { + "ccount": "^1.0.0", + "is-alphanumeric": "^1.0.0", + "is-decimal": "^1.0.0", + "is-whitespace-character": "^1.0.0", + "longest-streak": "^2.0.1", + "markdown-escapes": "^1.0.0", + "markdown-table": "^1.1.0", + "mdast-util-compact": "^1.0.0", + "parse-entities": "^1.0.2", + "repeat-string": "^1.5.4", + "state-toggle": "^1.0.0", + "stringify-entities": "^1.0.1", + "unherit": "^1.0.4", + "xtend": "^4.0.1" + }, + "deprecated": false, + "description": "Markdown compiler for remark", + "files": [ + "index.js", + "lib" + ], + "homepage": "http://remark.js.org", + "keywords": [ + "markdown", + "abstract", + "syntax", + "tree", + "ast", + "stringify" + ], + "license": "MIT", + "name": "remark-stringify", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark/tree/master/packages/remark-stringify" + }, + "version": "5.0.0", + "xo": false +} diff --git a/node_modules/remark-stringify/readme.md b/node_modules/remark-stringify/readme.md new file mode 100644 index 00000000..111c5539 --- /dev/null +++ b/node_modules/remark-stringify/readme.md @@ -0,0 +1,263 @@ +# remark-stringify [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] + +[Compiler][] for [**unified**][unified]. Stringifies an +[**MDAST**][mdast] syntax tree to markdown. Used in the [**remark** +processor][processor]. Can be [extended][extend] to change how +markdown is compiled. + +## Installation + +[npm][]: + +```sh +npm install remark-stringify +``` + +## Usage + +```js +var unified = require('unified'); +var createStream = require('unified-stream'); +var parse = require('remark-parse'); +var toc = require('remark-toc'); +var stringify = require('remark-stringify'); + +var processor = unified() + .use(parse) + .use(toc) + .use(stringify, { + bullet: '*', + fence: '~', + fences: true, + incrementListMarker: false + }); + +process.stdin + .pipe(createStream(processor)) + .pipe(process.stdout); +``` + +## Table of Contents + +* [API](#api) + * [processor.use(stringify\[, options\])](#processorusestringify-options) + * [stringify.Compiler](#stringifycompiler) +* [Extending the Compiler](#extending-the-compiler) + * [Compiler#visitors](#compilervisitors) + * [function visitor(node\[, parent\])](#function-visitornode-parent) +* [License](#license) + +## API + +### `processor.use(stringify[, options])` + +Configure the `processor` to stringify [**MDAST**][mdast] syntax trees +to markdown. + +##### `options` + +Options are passed directly, or passed later through [`processor.data()`][data]. + +###### `options.gfm` + +Stringify with the required escapes for GFM compatible markdown (`boolean`, +default: `true`). + +* Escape pipes (`|`, for tables) +* Escape colons (`:`, for literal URLs) +* Escape tildes (`~`, for strike-through) + +###### `options.commonmark` + +Stringify for CommonMark compatible markdown (`boolean`, default: `false`). + +* Compile adjacent blockquotes separately +* Escape more characters using slashes, instead of as entities + +###### `options.pedantic` + +Stringify for pedantic compatible markdown (`boolean`, default: `false`). + +* Escape underscores in words + +###### `options.entities` + +How to stringify entities (`string` or `boolean`, default: `false`): + +* `true` — Entities are generated for special HTML characters + (`&` > `&`) and non-ASCII characters (`©` > `©`). + If named entities are not (widely) supported, numbered character + references are used (`’` > `’`) +* `'numbers'` — Numbered entities are generated (`&` > `&`) + for special HTML characters and non-ASCII characters +* `'escape'` — Special HTML characters are encoded (`&` > + `&`, `’` > `’`), non-ASCII characters not (ö persists) + +###### `options.setext` + +Compile headings, when possible, in Setext-style (`boolean`, default: `false`). +Uses `=` for level one headings and `-` for level two headings. Other heading +levels are compiled as ATX (respecting `closeAtx`). + +###### `options.closeAtx` + +Compile ATX headings with the same amount of closing hashes as opening hashes +(`boolean`, default: `false`). + +###### `options.looseTable` + +Create tables without fences: initial and final pipes (`boolean`, default: +`false`). + +###### `options.spacedTable` + +Create tables without spacing between pipes and content (`boolean`, default: +`true`). + +###### `options.paddedTable` + +Create tables with padding in each cell so that they are the same size +(`boolean`, default: `true`). + +###### `options.stringLength` + +Function passed to [`markdown-table`][markdown-table] to detect the length of a +table cell (`Function`, default: [`s => s.length`][string-length]). + +###### `options.fence` + +Fence marker to use for code blocks (`'~'` or ``'`'``, default: ``'`'``). + +###### `options.fences` + +Stringify code blocks without language with fences (`boolean`, default: +`false`). + +###### `options.bullet` + +Bullet marker to use for unordered list items (`'-'`, `'*'`, or `'+'`, +default: `'-'`). + +###### `options.listItemIndent` + +How to indent the content from list items (`'tab'`, `'mixed'` or `'1'`, +default: `'tab'`). + +* `'tab'`: use tab stops (4 spaces) +* `'1'`: use one space +* `'mixed'`: use `1` for tight and `tab` for loose list items + +###### `options.incrementListMarker` + +Whether to increment ordered list item bullets (`boolean`, default: `true`). + +###### `options.rule` + +Marker to use for thematic breaks / horizontal rules (`'-'`, `'*'`, or `'_'`, +default: `'*'`). + +###### `options.ruleRepetition` + +Number of markers to use for thematic breaks / horizontal rules (`number`, +default: `3`). Should be `3` or more. + +###### `options.ruleSpaces` + +Whether to pad thematic break (horizontal rule) markers with spaces (`boolean`, +default `true`). + +###### `options.strong` + +Marker to use for importance (`'_'` or `'*'`, default `'*'`). + +###### `options.emphasis` + +Marker to use for emphasis (`'_'` or `'*'`, default `'_'`). + +### `stringify.Compiler` + +Access to the raw [compiler][], if you need it. + +## Extending the Compiler + +If this plugin is used, it adds a [`Compiler`][compiler] constructor +to the `processor`. Other plugins can change and add visitors on +the compiler’s prototype to change how markdown is stringified. + +The below plugin modifies a [visitor][] to add an extra blank line +before level two headings. + +```js +module.exports = gap; + +function gap() { + var Compiler = this.Compiler; + var visitors = Compiler.prototype.visitors; + var original = visitors.heading; + + visitors.heading = function heading(node) { + return (node.depth === 2 ? '\n' : '') + original.apply(this, arguments); + } +} +``` + +### `Compiler#visitors` + +An object mapping [node][] types to [`visitor`][visitor]s. + +### `function visitor(node[, parent])` + +Stringify `node`. + +###### Parameters + +* `node` ([`Node`][node]) — Node to compile +* `parent` ([`Node`][node], optional) — Parent of `node` + +###### Returns + +`string`, the compiled given `node`. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/remarkjs/remark.svg + +[build-status]: https://travis-ci.org/remarkjs/remark + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg + +[coverage-status]: https://codecov.io/github/remarkjs/remark + +[chat-badge]: https://img.shields.io/gitter/room/remarkjs/Lobby.svg + +[chat]: https://gitter.im/remarkjs/Lobby + +[license]: https://github.com/remarkjs/remark/blob/master/LICENSE + +[author]: http://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[unified]: https://github.com/unifiedjs/unified + +[processor]: https://github.com/remarkjs/remark + +[data]: https://github.com/unifiedjs/unified#processordatakey-value + +[compiler]: https://github.com/unifiedjs/unified#processorcompiler + +[mdast]: https://github.com/syntax-tree/mdast + +[node]: https://github.com/syntax-tree/unist#node + +[extend]: #extending-the-compiler + +[visitor]: #function-visitornode-parent + +[markdown-table]: https://github.com/wooorm/markdown-table + +[string-length]: https://github.com/wooorm/markdown-table#stringlengthcell diff --git a/node_modules/remark/index.js b/node_modules/remark/index.js new file mode 100644 index 00000000..a315ad14 --- /dev/null +++ b/node_modules/remark/index.js @@ -0,0 +1,7 @@ +'use strict'; + +var unified = require('unified'); +var parse = require('remark-parse'); +var stringify = require('remark-stringify'); + +module.exports = unified().use(parse).use(stringify).freeze(); diff --git a/node_modules/remark/package.json b/node_modules/remark/package.json new file mode 100644 index 00000000..d4833221 --- /dev/null +++ b/node_modules/remark/package.json @@ -0,0 +1,71 @@ +{ + "_from": "remark@^9.0.0", + "_id": "remark@9.0.0", + "_inBundle": false, + "_integrity": "sha512-amw8rGdD5lHbMEakiEsllmkdBP+/KpjW/PRK6NSGPZKCQowh0BT4IWXDAkRMyG3SB9dKPXWMviFjNusXzXNn3A==", + "_location": "/remark", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "remark@^9.0.0", + "name": "remark", + "escapedName": "remark", + "rawSpec": "^9.0.0", + "saveSpec": null, + "fetchSpec": "^9.0.0" + }, + "_requiredBy": [ + "/remark-cli" + ], + "_resolved": "https://registry.npmjs.org/remark/-/remark-9.0.0.tgz", + "_shasum": "c5cfa8ec535c73a67c4b0f12bfdbd3a67d8b2f60", + "_spec": "remark@^9.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-cli", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "remark-parse": "^5.0.0", + "remark-stringify": "^5.0.0", + "unified": "^6.0.0" + }, + "deprecated": false, + "description": "Markdown processor powered by plugins", + "files": [ + "index.js" + ], + "homepage": "http://remark.js.org", + "keywords": [ + "markdown", + "abstract", + "syntax", + "tree", + "ast", + "parse", + "stringify", + "process" + ], + "license": "MIT", + "name": "remark", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark/tree/master/packages/remark" + }, + "scripts": {}, + "version": "9.0.0", + "xo": false +} diff --git a/node_modules/remark/readme.md b/node_modules/remark/readme.md new file mode 100644 index 00000000..5ec215cc --- /dev/null +++ b/node_modules/remark/readme.md @@ -0,0 +1,141 @@ +# remark [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] + +The [`remark`][remark] processor is a markdown processor powered by +[plugins][]. + +* Interface by [`unified`][unified] +* [**MDAST**][mdast] syntax tree +* Parses markdown to the tree with [`remark-parse`][parse] +* [Plugins][] transform the tree +* Compiles the tree to markdown using [`remark-stringify`][stringify] + +Don’t need the parser? Or the compiler? [That’s OK][unified-usage]. + +## Installation + +[npm][]: + +```sh +npm install remark +``` + +## Usage + +###### Common example + +This example lints markdown and turns it into HTML. + +```js +var remark = require('remark'); +var recommended = require('remark-preset-lint-recommended'); +var html = require('remark-html'); +var report = require('vfile-reporter'); + +remark() + .use(recommended) + .use(html) + .process('## Hello world!', function (err, file) { + console.error(report(err || file)); + console.log(String(file)); + }); +``` + +Yields: + +```txt +1:1 warning Missing newline character at end of file final-newline remark-lint + +⚠ 1 warning +``` + +```html +

Hello world!

+``` + +###### Settings through data + +This example prettifies markdown and configures [`remark-parse`][parse] and +[`remark-stringify`][stringify] through [data][]. + +```js +var remark = require('remark'); + +remark() + .data('settings', {commonmark: true, emphasis: '*', strong: '*'}) + .process('_Emphasis_ and __importance__', function (err, file) { + if (err) throw err; + console.log(String(file)); + }); +``` + +Yields: + +```markdown +*Emphasis* and **importance** +``` + +###### Settings through a preset + +This example prettifies markdown and configures [`remark-parse`][parse] and +[`remark-stringify`][stringify] through a [preset][]. + +```js +var remark = require('remark'); + +remark() + .use({ + settings: {commonmark: true, emphasis: '*', strong: '*'} + }) + .process('_Emphasis_ and __importance__', function (err, file) { + if (err) throw err; + console.log(String(file)); + }); +``` + +Yields: + +```markdown +*Emphasis* and **importance** +``` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/remarkjs/remark.svg + +[build-status]: https://travis-ci.org/remarkjs/remark + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg + +[coverage-status]: https://codecov.io/github/remarkjs/remark + +[chat-badge]: https://img.shields.io/gitter/room/remarkjs/Lobby.svg + +[chat]: https://gitter.im/remarkjs/Lobby + +[license]: https://github.com/remarkjs/remark/blob/master/LICENSE + +[author]: http://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[remark]: https://github.com/remarkjs/remark + +[unified]: https://github.com/unifiedjs/unified + +[mdast]: https://github.com/syntax-tree/mdast + +[parse]: https://github.com/remarkjs/remark/blob/master/packages/remark-parse + +[stringify]: https://github.com/remarkjs/remark/blob/master/packages/remark-stringify + +[plugins]: https://github.com/remarkjs/remark/blob/master/doc/plugins.md + +[unified-usage]: https://github.com/unifiedjs/unified#usage + +[preset]: https://github.com/unifiedjs/unified#preset + +[data]: https://github.com/unifiedjs/unified#processordatakey-value diff --git a/node_modules/remove-trailing-separator/history.md b/node_modules/remove-trailing-separator/history.md new file mode 100644 index 00000000..e15e8a46 --- /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 00000000..512306b8 --- /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 00000000..a169aff7 --- /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 00000000..eb5ce9c7 --- /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": "/home/remi/github/CPP_BIDS/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 00000000..747086af --- /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 00000000..7cccaf9e --- /dev/null +++ b/node_modules/repeat-element/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-present, 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 00000000..6006418b --- /dev/null +++ b/node_modules/repeat-element/README.md @@ -0,0 +1,99 @@ +# repeat-element [![NPM version](https://img.shields.io/npm/v/repeat-element.svg?style=flat)](https://www.npmjs.com/package/repeat-element) [![NPM monthly downloads](https://img.shields.io/npm/dm/repeat-element.svg?style=flat)](https://npmjs.org/package/repeat-element) [![NPM total downloads](https://img.shields.io/npm/dt/repeat-element.svg?style=flat)](https://npmjs.org/package/repeat-element) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/repeat-element.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/repeat-element) + +> Create an array by repeating the given value n times. + +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 repeat-element +``` + +## Usage + +```js +const 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 ] +``` + +## 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 +``` + +
+ +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 17 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [LinusU](https://github.com/LinusU) | +| 1 | [architectcodes](https://github.com/architectcodes) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/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 August 19, 2018._ \ No newline at end of file diff --git a/node_modules/repeat-element/index.js b/node_modules/repeat-element/index.js new file mode 100644 index 00000000..06a8d01d --- /dev/null +++ b/node_modules/repeat-element/index.js @@ -0,0 +1,18 @@ +/*! + * repeat-element + * + * Copyright (c) 2015-present, 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 00000000..ce9c31ac --- /dev/null +++ b/node_modules/repeat-element/package.json @@ -0,0 +1,82 @@ +{ + "_from": "repeat-element@^1.1.2", + "_id": "repeat-element@1.1.3", + "_inBundle": false, + "_integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "_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", + "/fill-range", + "/readdirp/braces" + ], + "_resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "_shasum": "782e0d825c0c5a3bb39731f84efee6b742e6b1ce", + "_spec": "repeat-element@^1.1.2", + "_where": "/home/remi/github/CPP_BIDS/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": "^2.0.0", + "chalk": "^2.4.1", + "glob": "^7.1.2", + "gulp-format-md": "^1.0.0", + "minimist": "^1.2.0", + "mocha": "^3.5.3" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/repeat-element", + "keywords": [ + "array", + "element", + "repeat", + "string" + ], + "license": "MIT", + "main": "index.js", + "name": "repeat-element", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/repeat-element.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + }, + "version": "1.1.3" +} diff --git a/node_modules/repeat-string/LICENSE b/node_modules/repeat-string/LICENSE new file mode 100644 index 00000000..39245ac1 --- /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 00000000..aaa5e91c --- /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 00000000..4459afd8 --- /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 00000000..0c083eac --- /dev/null +++ b/node_modules/repeat-string/package.json @@ -0,0 +1,133 @@ +{ + "_from": "repeat-string@^1.5.4", + "_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.4", + "name": "repeat-string", + "escapedName": "repeat-string", + "rawSpec": "^1.5.4", + "saveSpec": null, + "fetchSpec": "^1.5.4" + }, + "_requiredBy": [ + "/fill-range", + "/readdirp/fill-range", + "/remark-parse", + "/remark-stringify", + "/to-regex-range", + "/vfile-reporter" + ], + "_resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "_shasum": "8dcae470e1c88abc2d600fff4a776286da75e637", + "_spec": "repeat-string@^1.5.4", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-parse", + "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/replace-ext/LICENSE b/node_modules/replace-ext/LICENSE new file mode 100755 index 00000000..fd38d693 --- /dev/null +++ b/node_modules/replace-ext/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blaine Bublitz , Eric Schoffstall and other 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/replace-ext/README.md b/node_modules/replace-ext/README.md new file mode 100644 index 00000000..8775983b --- /dev/null +++ b/node_modules/replace-ext/README.md @@ -0,0 +1,50 @@ +

+ + + +

+ +# replace-ext + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] + +Replaces a file extension with another one. + +## Usage + +```js +var replaceExt = require('replace-ext'); + +var path = '/some/dir/file.js'; +var newPath = replaceExt(path, '.coffee'); + +console.log(newPath); // /some/dir/file.coffee +``` + +## API + +### `replaceExt(path, extension)` + +Replaces the extension from `path` with `extension` and returns the updated path string. + +Does not replace the extension if `path` is not a string or is empty. + +## License + +MIT + +[downloads-image]: http://img.shields.io/npm/dm/replace-ext.svg +[npm-url]: https://www.npmjs.com/package/replace-ext +[npm-image]: http://img.shields.io/npm/v/replace-ext.svg + +[travis-url]: https://travis-ci.org/gulpjs/replace-ext +[travis-image]: http://img.shields.io/travis/gulpjs/replace-ext.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/replace-ext +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/replace-ext.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/replace-ext +[coveralls-image]: http://img.shields.io/coveralls/gulpjs/replace-ext/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/node_modules/replace-ext/index.js b/node_modules/replace-ext/index.js new file mode 100644 index 00000000..7cb7789e --- /dev/null +++ b/node_modules/replace-ext/index.js @@ -0,0 +1,18 @@ +'use strict'; + +var path = require('path'); + +function replaceExt(npath, ext) { + if (typeof npath !== 'string') { + return npath; + } + + if (npath.length === 0) { + return npath; + } + + var nFileName = path.basename(npath, path.extname(npath)) + ext; + return path.join(path.dirname(npath), nFileName); +} + +module.exports = replaceExt; diff --git a/node_modules/replace-ext/package.json b/node_modules/replace-ext/package.json new file mode 100644 index 00000000..66879984 --- /dev/null +++ b/node_modules/replace-ext/package.json @@ -0,0 +1,86 @@ +{ + "_from": "replace-ext@1.0.0", + "_id": "replace-ext@1.0.0", + "_inBundle": false, + "_integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", + "_location": "/replace-ext", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "replace-ext@1.0.0", + "name": "replace-ext", + "escapedName": "replace-ext", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/vfile" + ], + "_resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "_shasum": "de63128373fcbf7c3ccfa4de5a480c45a67958eb", + "_spec": "replace-ext@1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/vfile", + "author": { + "name": "Gulp Team", + "email": "team@gulpjs.com", + "url": "http://gulpjs.com/" + }, + "bugs": { + "url": "https://github.com/gulpjs/replace-ext/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Eric Schoffstall", + "email": "yo@contra.io" + }, + { + "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Replaces a file extension with another one", + "devDependencies": { + "eslint": "^1.10.3", + "eslint-config-gulp": "^2.0.0", + "expect": "^1.16.0", + "istanbul": "^0.4.3", + "istanbul-coveralls": "^1.0.3", + "jscs": "^2.3.5", + "jscs-preset-gulp": "^1.0.0", + "mocha": "^2.4.5" + }, + "engines": { + "node": ">= 0.10" + }, + "files": [ + "LICENSE", + "index.js" + ], + "homepage": "https://github.com/gulpjs/replace-ext#readme", + "keywords": [ + "gulp", + "extensions", + "filepath", + "basename" + ], + "license": "MIT", + "main": "index.js", + "name": "replace-ext", + "repository": { + "type": "git", + "url": "git+https://github.com/gulpjs/replace-ext.git" + }, + "scripts": { + "cover": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly", + "coveralls": "npm run cover && istanbul-coveralls", + "lint": "eslint . && jscs index.js test/", + "pretest": "npm run lint", + "test": "mocha --async-only" + }, + "version": "1.0.0" +} diff --git a/node_modules/resolve-from/index.d.ts b/node_modules/resolve-from/index.d.ts new file mode 100644 index 00000000..dd5f5ef6 --- /dev/null +++ b/node_modules/resolve-from/index.d.ts @@ -0,0 +1,31 @@ +declare const resolveFrom: { + /** + Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path. + + @param fromDirectory - Directory to resolve from. + @param moduleId - What you would use in `require()`. + @returns Resolved module path. Throws when the module can't be found. + + @example + ``` + import resolveFrom = require('resolve-from'); + + // There is a file at `./foo/bar.js` + + resolveFrom('foo', './bar'); + //=> '/Users/sindresorhus/dev/test/foo/bar.js' + ``` + */ + (fromDirectory: string, moduleId: string): string; + + /** + Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path. + + @param fromDirectory - Directory to resolve from. + @param moduleId - What you would use in `require()`. + @returns Resolved module path or `undefined` when the module can't be found. + */ + silent(fromDirectory: string, moduleId: string): string | undefined; +}; + +export = resolveFrom; diff --git a/node_modules/resolve-from/index.js b/node_modules/resolve-from/index.js new file mode 100644 index 00000000..44f291c1 --- /dev/null +++ b/node_modules/resolve-from/index.js @@ -0,0 +1,47 @@ +'use strict'; +const path = require('path'); +const Module = require('module'); +const fs = require('fs'); + +const resolveFrom = (fromDirectory, moduleId, silent) => { + if (typeof fromDirectory !== 'string') { + throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``); + } + + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } + + try { + fromDirectory = fs.realpathSync(fromDirectory); + } catch (error) { + if (error.code === 'ENOENT') { + fromDirectory = path.resolve(fromDirectory); + } else if (silent) { + return; + } else { + throw error; + } + } + + const fromFile = path.join(fromDirectory, 'noop.js'); + + const resolveFileName = () => Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: Module._nodeModulePaths(fromDirectory) + }); + + if (silent) { + try { + return resolveFileName(); + } catch (error) { + return; + } + } + + return resolveFileName(); +}; + +module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId); +module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true); diff --git a/node_modules/resolve-from/license b/node_modules/resolve-from/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/resolve-from/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/resolve-from/package.json b/node_modules/resolve-from/package.json new file mode 100644 index 00000000..e287e400 --- /dev/null +++ b/node_modules/resolve-from/package.json @@ -0,0 +1,68 @@ +{ + "_from": "resolve-from@^5.0.0", + "_id": "resolve-from@5.0.0", + "_inBundle": false, + "_integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "_location": "/resolve-from", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "resolve-from@^5.0.0", + "name": "resolve-from", + "escapedName": "resolve-from", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/load-plugin" + ], + "_resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "_shasum": "c35225843df8f776df21c57557bc087e9dfdfc69", + "_spec": "resolve-from@^5.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/load-plugin", + "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": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/resolve-from#readme", + "keywords": [ + "require", + "resolve", + "path", + "module", + "from", + "like", + "import" + ], + "license": "MIT", + "name": "resolve-from", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/resolve-from.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "5.0.0" +} diff --git a/node_modules/resolve-from/readme.md b/node_modules/resolve-from/readme.md new file mode 100644 index 00000000..fd4f46f9 --- /dev/null +++ b/node_modules/resolve-from/readme.md @@ -0,0 +1,72 @@ +# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) + +> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path + + +## Install + +``` +$ npm install resolve-from +``` + + +## Usage + +```js +const resolveFrom = require('resolve-from'); + +// There is a file at `./foo/bar.js` + +resolveFrom('foo', './bar'); +//=> '/Users/sindresorhus/dev/test/foo/bar.js' +``` + + +## API + +### resolveFrom(fromDirectory, moduleId) + +Like `require()`, throws when the module can't be found. + +### resolveFrom.silent(fromDirectory, moduleId) + +Returns `undefined` instead of throwing when the module can't be found. + +#### fromDirectory + +Type: `string` + +Directory to resolve from. + +#### moduleId + +Type: `string` + +What you would use in `require()`. + + +## Tip + +Create a partial using a bound function if you want to resolve from the same `fromDirectory` multiple times: + +```js +const resolveFromFoo = resolveFrom.bind(null, 'foo'); + +resolveFromFoo('./bar'); +resolveFromFoo('./baz'); +``` + + +## Related + +- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory +- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path +- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory +- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point +- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily +- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/resolve-url/.jshintrc b/node_modules/resolve-url/.jshintrc new file mode 100644 index 00000000..8703acd7 --- /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 00000000..0595be36 --- /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 00000000..31aa6f4e --- /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 00000000..2a4a6304 --- /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 00000000..f37cf005 --- /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 00000000..b53b3273 --- /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": "/home/remi/github/CPP_BIDS/node_modules/source-map-resolve", + "author": { + "name": "Simon Lydell" + }, + "bugs": { + "url": "https://github.com/lydell/resolve-url/issues" + }, + "bundleDependencies": false, + "deprecated": "https://github.com/lydell/resolve-url#deprecated", + "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 00000000..1f864e8d --- /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 00000000..dc5c5b7b --- /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 00000000..7f135a7c --- /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/ret/LICENSE b/node_modules/ret/LICENSE new file mode 100644 index 00000000..b351ee8e --- /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 00000000..28563e16 --- /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 00000000..0e151c39 --- /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 00000000..80677ee5 --- /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 00000000..5fb6be5d --- /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 00000000..94841451 --- /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 00000000..97d8cf51 --- /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 00000000..0f1391e0 --- /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": "/home/remi/github/CPP_BIDS/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/safe-buffer/LICENSE b/node_modules/safe-buffer/LICENSE new file mode 100644 index 00000000..0c068cee --- /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 00000000..e9a81afd --- /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.d.ts b/node_modules/safe-buffer/index.d.ts new file mode 100644 index 00000000..e9fed809 --- /dev/null +++ b/node_modules/safe-buffer/index.d.ts @@ -0,0 +1,187 @@ +declare module "safe-buffer" { + export class Buffer { + length: number + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): { type: 'Buffer', data: any[] }; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readUInt8(offset: number, noAssert?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + swap16(): Buffer; + swap32(): Buffer; + swap64(): Buffer; + writeUInt8(value: number, offset: number, noAssert?: boolean): number; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeInt8(value: number, offset: number, noAssert?: boolean): number; + writeInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeFloatLE(value: number, offset: number, noAssert?: boolean): number; + writeFloatBE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; + fill(value: any, offset?: number, end?: number): this; + indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; + + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + */ + constructor (str: string, encoding?: string); + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + */ + constructor (size: number); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: Uint8Array); + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}. + * + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + */ + constructor (arrayBuffer: ArrayBuffer); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: any[]); + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + constructor (buffer: Buffer); + prototype: Buffer; + /** + * Allocates a new Buffer using an {array} of octets. + * + * @param array + */ + static from(array: any[]): Buffer; + /** + * 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. + * The optional {byteOffset} and {length} arguments specify a memory range + * within the {arrayBuffer} that will be shared by the Buffer. + * + * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() + * @param byteOffset + * @param length + */ + static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; + /** + * Copies the passed {buffer} data onto a new Buffer instance. + * + * @param buffer + */ + static from(buffer: Buffer): Buffer; + /** + * 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'. + * + * @param str + */ + static from(str: string, encoding?: string): Buffer; + /** + * Returns true if {obj} is a Buffer + * + * @param obj object to test. + */ + static isBuffer(obj: any): obj is Buffer; + /** + * Returns true if {encoding} is a valid encoding argument. + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + * + * @param encoding string to test. + */ + static isEncoding(encoding: string): boolean; + /** + * Gives the actual byte length of a string. encoding defaults to 'utf8'. + * This is not the same as String.prototype.length since that returns the number of characters in a string. + * + * @param string string to test. + * @param encoding encoding used to evaluate (defaults to 'utf8') + */ + static byteLength(string: string, encoding?: string): number; + /** + * Returns a buffer which is the result of concatenating all the buffers in the list together. + * + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. + * If the list has exactly one item, then the first item of the list is returned. + * If the list has more than one item, then a new Buffer is created. + * + * @param list An array of Buffer objects to concatenate + * @param totalLength Total length of the buffers when concatenated. + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. + */ + static concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + static compare(buf1: Buffer, buf2: Buffer): number; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @param fill if specified, buffer will be initialized by calling buf.fill(fill). + * If parameter is omitted, buffer will be filled with zeros. + * @param encoding encoding used for call to buf.fill while initalizing + */ + static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafe(size: number): Buffer; + /** + * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafeSlow(size: number): Buffer; + } +} \ No newline at end of file diff --git a/node_modules/safe-buffer/index.js b/node_modules/safe-buffer/index.js new file mode 100644 index 00000000..22438dab --- /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 00000000..ce042abc --- /dev/null +++ b/node_modules/safe-buffer/package.json @@ -0,0 +1,63 @@ +{ + "_from": "safe-buffer@~5.1.1", + "_id": "safe-buffer@5.1.2", + "_inBundle": false, + "_integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "_location": "/safe-buffer", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "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": [ + "/readable-stream", + "/string_decoder" + ], + "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "_shasum": "991ec69d296e0313747d59bdfd2b745c35f8828d", + "_spec": "safe-buffer@~5.1.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readable-stream", + "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" + }, + "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" + }, + "types": "index.d.ts", + "version": "5.1.2" +} diff --git a/node_modules/safe-regex/.travis.yml b/node_modules/safe-regex/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /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 00000000..ee27ba4b --- /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 00000000..f486f592 --- /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 00000000..488f5014 --- /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 00000000..78e75d95 --- /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": "/home/remi/github/CPP_BIDS/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 00000000..83673ac3 --- /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 00000000..0bda8504 --- /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/set-value/LICENSE b/node_modules/set-value/LICENSE new file mode 100644 index 00000000..d734237b --- /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 00000000..e336d744 --- /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 00000000..0b32e8fa --- /dev/null +++ b/node_modules/set-value/index.js @@ -0,0 +1,55 @@ +/*! + * 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}).filter(isValidKey); + 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; +}; + +function isValidKey(key) { + return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; +} 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 00000000..fa30c4cb --- /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 00000000..cdc45d4f --- /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 00000000..92a067fc --- /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 00000000..881426fa --- /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": "/home/remi/github/CPP_BIDS/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 00000000..750e7aa0 --- /dev/null +++ b/node_modules/set-value/package.json @@ -0,0 +1,121 @@ +{ + "_from": "set-value@^2.0.0", + "_id": "set-value@2.0.1", + "_inBundle": false, + "_integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "_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", + "/union-value" + ], + "_resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "_shasum": "a18d40530e6f07de4228c7defe4227af8cad005b", + "_spec": "set-value@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/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.1" +} diff --git a/node_modules/shellsubstitute/.npmignore b/node_modules/shellsubstitute/.npmignore new file mode 100644 index 00000000..80be2f40 --- /dev/null +++ b/node_modules/shellsubstitute/.npmignore @@ -0,0 +1,2 @@ +.*.sw? +/node_modules diff --git a/node_modules/shellsubstitute/.travis.yml b/node_modules/shellsubstitute/.travis.yml new file mode 100644 index 00000000..851fb952 --- /dev/null +++ b/node_modules/shellsubstitute/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: +- node diff --git a/node_modules/shellsubstitute/index.js b/node_modules/shellsubstitute/index.js new file mode 100644 index 00000000..34cb3412 --- /dev/null +++ b/node_modules/shellsubstitute/index.js @@ -0,0 +1,9 @@ +module.exports = function (s, vars) { + return s.replace(/(\\*)(\$([_a-z0-9]+)|\${([_a-z0-9]+)})/ig, function (_, escape, varExpression, variable, bracedVariable) { + if (!(escape.length % 2)) { + return escape.substring(Math.ceil(escape.length / 2)) + (vars[variable || bracedVariable] || ''); + } else { + return escape.substring(1) + varExpression; + } + }); +}; diff --git a/node_modules/shellsubstitute/package.json b/node_modules/shellsubstitute/package.json new file mode 100644 index 00000000..8a2939f8 --- /dev/null +++ b/node_modules/shellsubstitute/package.json @@ -0,0 +1,63 @@ +{ + "_from": "shellsubstitute@^1.1.0", + "_id": "shellsubstitute@1.2.0", + "_inBundle": false, + "_integrity": "sha1-5PcCpQxRiw9v6YRRiQ1wWvKba3A=", + "_location": "/shellsubstitute", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "shellsubstitute@^1.1.0", + "name": "shellsubstitute", + "escapedName": "shellsubstitute", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/npm-prefix" + ], + "_resolved": "https://registry.npmjs.org/shellsubstitute/-/shellsubstitute-1.2.0.tgz", + "_shasum": "e4f702a50c518b0f6fe98451890d705af29b6b70", + "_spec": "shellsubstitute@^1.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/npm-prefix", + "author": { + "name": "Tim Macfarlane", + "email": "timmacfarlane@gmail.com" + }, + "bugs": { + "url": "https://github.com/featurist/shellsubstitute/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Like shell substitution but for your JS.", + "devDependencies": { + "chai": "^1.9.2", + "mocha": "^1.21.5" + }, + "directories": { + "test": "test" + }, + "homepage": "https://github.com/featurist/shellsubstitute", + "keywords": [ + "shell", + "environment", + "variables", + "env", + "substitute", + "replace" + ], + "license": "ISC", + "main": "index.js", + "name": "shellsubstitute", + "repository": { + "type": "git", + "url": "git+https://github.com/featurist/shellsubstitute.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.2.0" +} diff --git a/node_modules/shellsubstitute/readme.md b/node_modules/shellsubstitute/readme.md new file mode 100644 index 00000000..2cd14c97 --- /dev/null +++ b/node_modules/shellsubstitute/readme.md @@ -0,0 +1,22 @@ +# Shell Substitute [![npm version](https://img.shields.io/npm/v/shellsubstitute.svg)](https://www.npmjs.com/package/shellsubstitute) [![npm](https://img.shields.io/npm/dm/shellsubstitute.svg)](https://www.npmjs.com/package/shellsubstitute) [![Build Status](https://travis-ci.org/featurist/shellsubstitute.svg?branch=master)](https://travis-ci.org/featurist/shellsubstitute) + +Like shell substitution but for your JS. + + var substitute = require('shellsubstitute'); + + substitute('Hi $USER', {USER: 'Josh'}) // Hi Josh + substitute('Hi ${USER}', {USER: 'Josh'}) // Hi Josh + + // escape + substitute('Hi \\$USER', {USER: 'Josh'}) // Hi $USER + substitute('Hi \\${USER}', {USER: 'Josh'}) // Hi ${USER} + + // escape escapes + substitute('Hi \\\\$USER', {USER: 'Josh'}) // Hi \$USER + substitute('Hi \\\\${USER}', {USER: 'Josh'}) // Hi \${USER} + +## Syntax + +Variables are `$` followed by `_` or numbers `0-9` or upper or lower-case characters `a-z`. + +Variables can be wrapped in braces `{...}`. Useful to delimit the variable from following text. diff --git a/node_modules/shellsubstitute/test/spec.js b/node_modules/shellsubstitute/test/spec.js new file mode 100644 index 00000000..68ef8a6f --- /dev/null +++ b/node_modules/shellsubstitute/test/spec.js @@ -0,0 +1,63 @@ +var chai = require('chai'); +var expect = chai.expect; +var substitute = require('..'); + +describe('shellsubstitute', function () { + it('can substitute a simple variable', function () { + expect(substitute('user: $USER', {USER: 'harry'})).to.eql('user: harry'); + }); + + it('can substitute a simple variable with numbers', function () { + expect(substitute('user: $1USER2', {'1USER2': 'harry'})).to.eql('user: harry'); + }); + + it('can substitute a simple variable with underscores', function () { + expect(substitute('user: $USER_', {'USER_': 'harry'})).to.eql('user: harry'); + }); + + it('can substitute several variables', function () { + expect(substitute('user: $USER, path: $PATH', {USER: 'harry', PATH: '/path'})).to.eql('user: harry, path: /path'); + }); + + it('can substitute variables in braces', function () { + expect(substitute('user: ${USER}1', {USER: 'harry'})).to.eql('user: harry1'); + }); + + it('no variable becomes blank', function () { + expect(substitute('user: ${USER}1', {})).to.eql('user: 1'); + }); + + describe('escapes', function () { + it('can escape braces with \\', function () { + expect(substitute('user: \\${USER}', {USER: 'user'})).to.eql('user: ${USER}'); + }); + + it('can escape with \\', function () { + expect(substitute('user: \\$USER', {USER: 'user'})).to.eql('user: $USER'); + }); + + it('can escape escapes with \\\\', function () { + expect(substitute('user: \\\\${USER}', {USER: 'user'})).to.eql('user: \\user'); + }); + + it('can escape escapes with \\\\', function () { + expect(substitute('user: \\\\$USER', {USER: 'user'})).to.eql('user: \\user'); + }); + + it('can escape braces with \\\\\\', function () { + expect(substitute('user: \\\\\\${USER}', {USER: 'user'})).to.eql('user: \\\\${USER}'); + }); + + it('can escape with \\\\\\', function () { + expect(substitute('user: \\\\\\$USER', {USER: 'user'})).to.eql('user: \\\\$USER'); + }); + + it('can escape escapes with \\\\\\\\', function () { + expect(substitute('user: \\\\\\\\${USER}', {USER: 'user'})).to.eql('user: \\\\user'); + }); + + it('can escape escapes with \\\\\\\\', function () { + expect(substitute('user: \\\\\\\\$USER', {USER: 'user'})).to.eql('user: \\\\user'); + }); + }); +}); diff --git a/node_modules/sliced/History.md b/node_modules/sliced/History.md new file mode 100644 index 00000000..e45cefe8 --- /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 00000000..38c529da --- /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 00000000..b6ff85eb --- /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 00000000..d88c85b1 --- /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 00000000..f8ed4c97 --- /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": "range", + "registry": true, + "raw": "sliced@^1.0.1", + "name": "sliced", + "escapedName": "sliced", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/wrapped" + ], + "_resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", + "_shasum": "0b3a662b5d04c3177b1926bea82b03f837a2ef41", + "_spec": "sliced@^1.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/wrapped", + "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 00000000..9a1c8567 --- /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 00000000..2300a3cd --- /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 00000000..0f66ff5a --- /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 00000000..ec85897e --- /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 00000000..2f1af05f --- /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 00000000..27c19ebf --- /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 00000000..b7377dad --- /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": "/home/remi/github/CPP_BIDS/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/node_modules/is-accessor-descriptor/LICENSE b/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/LICENSE new file mode 100644 index 00000000..e33d14b7 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-accessor-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. diff --git a/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/README.md b/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/README.md new file mode 100644 index 00000000..d198e1f0 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/README.md @@ -0,0 +1,144 @@ +# is-accessor-descriptor [![NPM version](https://img.shields.io/npm/v/is-accessor-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-accessor-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-accessor-descriptor.svg?style=flat)](https://npmjs.org/package/is-accessor-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-accessor-descriptor.svg?style=flat)](https://npmjs.org/package/is-accessor-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-accessor-descriptor.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-accessor-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript accessor descriptor. + +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 is-accessor-descriptor +``` + +## 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 +``` + +## 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-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.") +* [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 "Returns true if an object was created by the `Object` constructor.") +* [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.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 22 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [realityking](https://github.com/realityking) | + +### 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 01, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/index.js b/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/index.js new file mode 100644 index 00000000..d2e6fe8b --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/index.js @@ -0,0 +1,69 @@ +/*! + * is-accessor-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released 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/node_modules/is-accessor-descriptor/package.json b/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/package.json new file mode 100644 index 00000000..0e706955 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-accessor-descriptor/package.json @@ -0,0 +1,110 @@ +{ + "_from": "is-accessor-descriptor@^1.0.0", + "_id": "is-accessor-descriptor@1.0.0", + "_inBundle": false, + "_integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "_location": "/snapdragon-node/is-accessor-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-accessor-descriptor@^1.0.0", + "name": "is-accessor-descriptor", + "escapedName": "is-accessor-descriptor", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/snapdragon-node/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "_shasum": "169c2f6d3df1f992618072365c9b0ea1f6878656", + "_spec": "is-accessor-descriptor@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/snapdragon-node/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, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Rouven Weßling", + "url": "www.rouvenwessling.de" + } + ], + "dependencies": { + "kind-of": "^6.0.0" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript accessor descriptor.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "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": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "is-plain-object", + "isobject" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "1.0.0" +} diff --git a/node_modules/snapdragon-node/node_modules/is-data-descriptor/LICENSE b/node_modules/snapdragon-node/node_modules/is-data-descriptor/LICENSE new file mode 100644 index 00000000..e33d14b7 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-data-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. diff --git a/node_modules/snapdragon-node/node_modules/is-data-descriptor/README.md b/node_modules/snapdragon-node/node_modules/is-data-descriptor/README.md new file mode 100644 index 00000000..42b07144 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-data-descriptor/README.md @@ -0,0 +1,161 @@ +# is-data-descriptor [![NPM version](https://img.shields.io/npm/v/is-data-descriptor.svg?style=flat)](https://www.npmjs.com/package/is-data-descriptor) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-data-descriptor.svg?style=flat)](https://npmjs.org/package/is-data-descriptor) [![NPM total downloads](https://img.shields.io/npm/dt/is-data-descriptor.svg?style=flat)](https://npmjs.org/package/is-data-descriptor) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-data-descriptor.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-data-descriptor) + +> Returns true if a value has the characteristics of a valid JavaScript data descriptor. + +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 is-data-descriptor +``` + +## 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' +``` + +## 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-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.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 21 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [realityking](https://github.com/realityking) | + +### 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 01, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon-node/node_modules/is-data-descriptor/index.js b/node_modules/snapdragon-node/node_modules/is-data-descriptor/index.js new file mode 100644 index 00000000..cfeae361 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-data-descriptor/index.js @@ -0,0 +1,49 @@ +/*! + * is-data-descriptor + * + * Copyright (c) 2015-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +module.exports = function isDataDescriptor(obj, prop) { + // data descriptor properties + var data = { + configurable: 'boolean', + enumerable: 'boolean', + writable: 'boolean' + }; + + 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; +}; diff --git a/node_modules/snapdragon-node/node_modules/is-data-descriptor/package.json b/node_modules/snapdragon-node/node_modules/is-data-descriptor/package.json new file mode 100644 index 00000000..a8ded17e --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-data-descriptor/package.json @@ -0,0 +1,109 @@ +{ + "_from": "is-data-descriptor@^1.0.0", + "_id": "is-data-descriptor@1.0.0", + "_inBundle": false, + "_integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "_location": "/snapdragon-node/is-data-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-data-descriptor@^1.0.0", + "name": "is-data-descriptor", + "escapedName": "is-data-descriptor", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/snapdragon-node/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "_shasum": "d84876321d0e7add03990406abbbbd36ba9268c7", + "_spec": "is-data-descriptor@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/snapdragon-node/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, + "contributors": [ + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Rouven Weßling", + "url": "www.rouvenwessling.de" + } + ], + "dependencies": { + "kind-of": "^6.0.0" + }, + "deprecated": false, + "description": "Returns true if a value has the characteristics of a valid JavaScript data descriptor.", + "devDependencies": { + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "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": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "is-accessor-descriptor", + "is-data-descriptor", + "is-descriptor", + "isobject" + ] + }, + "lint": { + "reflinks": true + } + }, + "version": "1.0.0" +} diff --git a/node_modules/snapdragon-node/node_modules/is-descriptor/LICENSE b/node_modules/snapdragon-node/node_modules/is-descriptor/LICENSE new file mode 100644 index 00000000..c0d7f136 --- /dev/null +++ b/node_modules/snapdragon-node/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/node_modules/is-descriptor/README.md b/node_modules/snapdragon-node/node_modules/is-descriptor/README.md new file mode 100644 index 00000000..658e5330 --- /dev/null +++ b/node_modules/snapdragon-node/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/node_modules/is-descriptor/index.js b/node_modules/snapdragon-node/node_modules/is-descriptor/index.js new file mode 100644 index 00000000..c9b91d76 --- /dev/null +++ b/node_modules/snapdragon-node/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/node_modules/is-descriptor/package.json b/node_modules/snapdragon-node/node_modules/is-descriptor/package.json new file mode 100644 index 00000000..52510089 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/is-descriptor/package.json @@ -0,0 +1,114 @@ +{ + "_from": "is-descriptor@^1.0.0", + "_id": "is-descriptor@1.0.2", + "_inBundle": false, + "_integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "_location": "/snapdragon-node/is-descriptor", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-descriptor@^1.0.0", + "name": "is-descriptor", + "escapedName": "is-descriptor", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/snapdragon-node/define-property" + ], + "_resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "_shasum": "3b159746a66604b04f8c81524ba365c5f14d86ec", + "_spec": "is-descriptor@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/snapdragon-node/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": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "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.5.3" + }, + "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": "1.0.2" +} diff --git a/node_modules/snapdragon-node/node_modules/isobject/LICENSE b/node_modules/snapdragon-node/node_modules/isobject/LICENSE new file mode 100644 index 00000000..943e71d0 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/isobject/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/snapdragon-node/node_modules/isobject/README.md b/node_modules/snapdragon-node/node_modules/isobject/README.md new file mode 100644 index 00000000..d01feaa4 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/isobject/README.md @@ -0,0 +1,122 @@ +# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM monthly downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![NPM total downloads](https://img.shields.io/npm/dt/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat&label=Travis)](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 --save isobject +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add isobject +``` + +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](https://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); +``` + +## 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.") +* [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 "Returns true if an object was created by the `Object` constructor.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") +* [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.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 29 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [magnudae](https://github.com/magnudae) | +| 1 | [LeSuisse](https://github.com/LeSuisse) | +| 1 | [tmcw](https://github.com/tmcw) | + +### 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 30, 2017._ \ No newline at end of file diff --git a/node_modules/snapdragon-node/node_modules/isobject/index.d.ts b/node_modules/snapdragon-node/node_modules/isobject/index.d.ts new file mode 100644 index 00000000..55f81c27 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/isobject/index.d.ts @@ -0,0 +1,5 @@ +export = isObject; + +declare function isObject(val: any): boolean; + +declare namespace isObject {} diff --git a/node_modules/snapdragon-node/node_modules/isobject/index.js b/node_modules/snapdragon-node/node_modules/isobject/index.js new file mode 100644 index 00000000..2d59958b --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/isobject/index.js @@ -0,0 +1,12 @@ +/*! + * isobject + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function isObject(val) { + return val != null && typeof val === 'object' && Array.isArray(val) === false; +}; diff --git a/node_modules/snapdragon-node/node_modules/isobject/package.json b/node_modules/snapdragon-node/node_modules/isobject/package.json new file mode 100644 index 00000000..cf122b35 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/isobject/package.json @@ -0,0 +1,119 @@ +{ + "_from": "isobject@^3.0.0", + "_id": "isobject@3.0.1", + "_inBundle": false, + "_integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "_location": "/snapdragon-node/isobject", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "isobject@^3.0.0", + "name": "isobject", + "escapedName": "isobject", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/snapdragon-node" + ], + "_resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "_shasum": "4e431e92b11a9731636aa1f9c8d1ccbcfdab78df", + "_spec": "isobject@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/snapdragon-node", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/isobject/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "url": "https://github.com/LeSuisse" + }, + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + }, + { + "name": "Magnús Dæhlen", + "url": "https://github.com/magnudae" + }, + { + "name": "Tom MacWright", + "url": "https://macwright.org" + } + ], + "dependencies": {}, + "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.d.ts", + "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" + }, + "types": "index.d.ts", + "verb": { + "related": { + "list": [ + "extend-shallow", + "is-plain-object", + "kind-of", + "merge-deep" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + }, + "version": "3.0.1" +} diff --git a/node_modules/snapdragon-node/node_modules/kind-of/CHANGELOG.md b/node_modules/snapdragon-node/node_modules/kind-of/CHANGELOG.md new file mode 100644 index 00000000..01687d5c --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/kind-of/CHANGELOG.md @@ -0,0 +1,160 @@ +# 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.3] - 2020-01-16 + +- Merge pull request #31 for issue #30 + +## [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 \ No newline at end of file diff --git a/node_modules/snapdragon-node/node_modules/kind-of/LICENSE b/node_modules/snapdragon-node/node_modules/kind-of/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/snapdragon-node/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/node_modules/kind-of/README.md b/node_modules/snapdragon-node/node_modules/kind-of/README.md new file mode 100644 index 00000000..0411dc58 --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/kind-of/README.md @@ -0,0 +1,367 @@ +# 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/micromatch/is-glob) | [homepage](https://github.com/micromatch/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 a number or string value is a finite number. Useful for regex… [more](https://github.com/jonschlinkert/is-number) | [homepage](https://github.com/jonschlinkert/is-number "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.") +* [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** | +| --- | --- | +| 102 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [aretecode](https://github.com/aretecode) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [doowb](https://github.com/doowb) | +| 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 | [tunnckoCore](https://github.com/tunnckoCore) | +| 1 | [xiaofen9](https://github.com/xiaofen9) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2020, [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.8.0, on January 16, 2020._ \ No newline at end of file diff --git a/node_modules/snapdragon-node/node_modules/kind-of/index.js b/node_modules/snapdragon-node/node_modules/kind-of/index.js new file mode 100644 index 00000000..dfa799b7 --- /dev/null +++ b/node_modules/snapdragon-node/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 typeof val.constructor === 'function' ? 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/snapdragon-node/node_modules/kind-of/package.json b/node_modules/snapdragon-node/node_modules/kind-of/package.json new file mode 100644 index 00000000..2f14e3bf --- /dev/null +++ b/node_modules/snapdragon-node/node_modules/kind-of/package.json @@ -0,0 +1,145 @@ +{ + "_from": "kind-of@^6.0.2", + "_id": "kind-of@6.0.3", + "_inBundle": false, + "_integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "_location": "/snapdragon-node/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": [ + "/snapdragon-node/is-accessor-descriptor", + "/snapdragon-node/is-data-descriptor", + "/snapdragon-node/is-descriptor" + ], + "_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "_shasum": "07c05034a6c349fa06e24fa35aa76db4580ce4dd", + "_spec": "kind-of@^6.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/snapdragon-node/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": { + "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.3" +} diff --git a/node_modules/snapdragon-node/package.json b/node_modules/snapdragon-node/package.json new file mode 100644 index 00000000..b198552d --- /dev/null +++ b/node_modules/snapdragon-node/package.json @@ -0,0 +1,107 @@ +{ + "_from": "snapdragon-node@^2.0.1", + "_id": "snapdragon-node@2.1.1", + "_inBundle": false, + "_integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "_location": "/snapdragon-node", + "_phantomChildren": {}, + "_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": [ + "/readdirp/braces" + ], + "_resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "_shasum": "6c175f86ff14bdb0724563e8f3c1b021a286853b", + "_spec": "snapdragon-node@^2.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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 00000000..9a1c8567 --- /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 00000000..b654e023 --- /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 00000000..68a030ec --- /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 00000000..b74bc630 --- /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": "/home/remi/github/CPP_BIDS/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 00000000..1e49edf8 --- /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 00000000..4006e10f --- /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 00000000..235b464b --- /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 00000000..0ce9d217 --- /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 00000000..a5a9b31c --- /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 00000000..c859696a --- /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 00000000..d8e638b4 --- /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 00000000..33f07e16 --- /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 00000000..65f90aca --- /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 00000000..8cac698a --- /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 00000000..3e0e5e13 --- /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 00000000..f444fe05 --- /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": "/home/remi/github/CPP_BIDS/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 00000000..fa30c4cb --- /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 00000000..cdc45d4f --- /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 00000000..92a067fc --- /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 00000000..55896722 --- /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": "/home/remi/github/CPP_BIDS/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/package.json b/node_modules/snapdragon/package.json new file mode 100644 index 00000000..f46b15bc --- /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-descriptor": "0.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": [ + "/nanomatch", + "/readdirp/braces", + "/readdirp/expand-brackets", + "/readdirp/extglob", + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "_shasum": "64922e7c565b0e14204ba1aa7d6964278d25182d", + "_spec": "snapdragon@^0.8.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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/LICENSE b/node_modules/source-map-resolve/LICENSE new file mode 100644 index 00000000..2ae97576 --- /dev/null +++ b/node_modules/source-map-resolve/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019 Simon Lydell +Copyright (c) 2019 ZHAO Jinxiang + +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/changelog.md b/node_modules/source-map-resolve/changelog.md new file mode 100644 index 00000000..7b3f94b4 --- /dev/null +++ b/node_modules/source-map-resolve/changelog.md @@ -0,0 +1,108 @@ +### Version 0.5.3 (2019-12-28) ### + +- Fixed: base64 encoded source maps now correctly decodes as utf-8. Previously, + non-ASCII characters could end up garbled. Thanks to ZHAO Jinxiang + (@xiaoxiangmoe)! (Note: This fix does not work in old evironments not + supporting both `TextDecoder` and `Uint8Array`.) +- Improved: Reduced size of the npm package. + +### Version 0.5.2 (2018-05-10) ### + +- Improved: Updated the version range of `atob` to disallow depending on `2.0.3` + which as a [security + vulnerability](https://snyk.io/test/npm/atob/2.0.3?severity=high&severity=medium&severity=low). + +### 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/lib/decode-uri-component.js b/node_modules/source-map-resolve/lib/decode-uri-component.js new file mode 100644 index 00000000..0739c20f --- /dev/null +++ b/node_modules/source-map-resolve/lib/decode-uri-component.js @@ -0,0 +1,8 @@ +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 00000000..e3a86c46 --- /dev/null +++ b/node_modules/source-map-resolve/lib/resolve-url.js @@ -0,0 +1,9 @@ +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 00000000..31ec3b2b --- /dev/null +++ b/node_modules/source-map-resolve/lib/source-map-resolve-node.js @@ -0,0 +1,342 @@ +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:([^,;]*)(;[^,;]*)*(?:,(.*))?$/ + +/** + * The media type for JSON text is application/json. + * + * {@link https://tools.ietf.org/html/rfc8259#section-11 | IANA Considerations } + * + * `text/json` is non-standard media type + */ +var jsonMimeTypeRegex = /^(?:application|text)\/json$/ + +/** + * JSON text exchanged between systems that are not part of a closed ecosystem + * MUST be encoded using UTF-8. + * + * {@link https://tools.ietf.org/html/rfc8259#section-8.1 | Character Encoding} + */ +var jsonCharacterEncoding = "utf-8" + +function base64ToBuf(b64) { + var binStr = atob(b64) + var len = binStr.length + var arr = new Uint8Array(len) + for (var i = 0; i < len; i++) { + arr[i] = binStr.charCodeAt(i) + } + return arr +} + +function decodeBase64String(b64) { + if (typeof TextDecoder === "undefined" || typeof Uint8Array === "undefined") { + return atob(b64) + } + var buf = base64ToBuf(b64); + // Note: `decoder.decode` method will throw a `DOMException` with the + // `"EncodingError"` value when an coding error is found. + var decoder = new TextDecoder(jsonCharacterEncoding, {fatal: true}) + return decoder.decode(buf); +} + +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] || "text/plain" + 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) + error.sourceMapData = data + throw error + } + try { + data.map = parseMapToJSON( + lastParameter === ";base64" ? decodeBase64String(encoded) : decodeURIComponent(encoded), + data + ) + } catch (error) { + error.sourceMapData = data + throw error + } + 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 00000000..d5772755 --- /dev/null +++ b/node_modules/source-map-resolve/package.json @@ -0,0 +1,81 @@ +{ + "_from": "source-map-resolve@^0.5.0", + "_id": "source-map-resolve@0.5.3", + "_inBundle": false, + "_integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "_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.3.tgz", + "_shasum": "190866bece7553e1f8f267a2ee82c606b5509a1a", + "_spec": "source-map-resolve@^0.5.0", + "_where": "/home/remi/github/CPP_BIDS/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.1.2", + "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": "1.1.0", + "jshint": "2.10.3", + "setimmediate": "1.0.5", + "simple-asyncify": "1.0.0", + "tape": "4.12.1" + }, + "files": [ + "lib", + "source-map-resolve.js" + ], + "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" + }, + "version": "0.5.3" +} diff --git a/node_modules/source-map-resolve/readme.md b/node_modules/source-map-resolve/readme.md new file mode 100644 index 00000000..5796ba1f --- /dev/null +++ b/node_modules/source-map-resolve/readme.md @@ -0,0 +1,231 @@ +Overview [![Build Status](https://travis-ci.org/lydell/source-map-resolve.svg?branch=master)](https://travis-ci.org/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. + +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 +======= + +[MIT](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 00000000..282b1260 --- /dev/null +++ b/node_modules/source-map-resolve/source-map-resolve.js @@ -0,0 +1,348 @@ +// 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:([^,;]*)(;[^,;]*)*(?:,(.*))?$/ + + /** + * The media type for JSON text is application/json. + * + * {@link https://tools.ietf.org/html/rfc8259#section-11 | IANA Considerations } + * + * `text/json` is non-standard media type + */ + var jsonMimeTypeRegex = /^(?:application|text)\/json$/ + + /** + * JSON text exchanged between systems that are not part of a closed ecosystem + * MUST be encoded using UTF-8. + * + * {@link https://tools.ietf.org/html/rfc8259#section-8.1 | Character Encoding} + */ + var jsonCharacterEncoding = "utf-8" + + function base64ToBuf(b64) { + var binStr = atob(b64) + var len = binStr.length + var arr = new Uint8Array(len) + for (var i = 0; i < len; i++) { + arr[i] = binStr.charCodeAt(i) + } + return arr + } + + function decodeBase64String(b64) { + if (typeof TextDecoder === "undefined" || typeof Uint8Array === "undefined") { + return atob(b64) + } + var buf = base64ToBuf(b64); + // Note: `decoder.decode` method will throw a `DOMException` with the + // `"EncodingError"` value when an coding error is found. + var decoder = new TextDecoder(jsonCharacterEncoding, {fatal: true}) + return decoder.decode(buf); + } + + function resolveSourceMapHelper(code, codeUrl) { + var url = sourceMappingURL.getFrom(code) + if (!url) { + return null + } + + var dataUri = url.match(dataUriRegex) + if (dataUri) { + var mimeType = dataUri[1] || "text/plain" + 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) + error.sourceMapData = data + throw error + } + try { + data.map = parseMapToJSON( + lastParameter === ";base64" ? decodeBase64String(encoded) : decodeURIComponent(encoded), + data + ) + } catch (error) { + error.sourceMapData = data + throw error + } + 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-url/.jshintrc b/node_modules/source-map-url/.jshintrc new file mode 100644 index 00000000..8f33293c --- /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 00000000..10052a95 --- /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 00000000..9831b7cd --- /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 00000000..e291a7f7 --- /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 00000000..11d569c9 --- /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 00000000..f43a2081 --- /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": "/home/remi/github/CPP_BIDS/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 00000000..216de5e5 --- /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 00000000..1724cb7c --- /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 00000000..630bc86f --- /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 00000000..bdcd6ae1 --- /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/CHANGELOG.md b/node_modules/source-map/CHANGELOG.md new file mode 100644 index 00000000..3a8c066c --- /dev/null +++ b/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/source-map/LICENSE b/node_modules/source-map/LICENSE new file mode 100644 index 00000000..ed1b7cf2 --- /dev/null +++ b/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/source-map/README.md b/node_modules/source-map/README.md new file mode 100644 index 00000000..32813394 --- /dev/null +++ b/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/source-map/dist/source-map.debug.js b/node_modules/source-map/dist/source-map.debug.js new file mode 100644 index 00000000..b5ab6382 --- /dev/null +++ b/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/source-map/dist/source-map.js b/node_modules/source-map/dist/source-map.js new file mode 100644 index 00000000..4e630e29 --- /dev/null +++ b/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/source-map/dist/source-map.min.js b/node_modules/source-map/dist/source-map.min.js new file mode 100644 index 00000000..f2a46bd0 --- /dev/null +++ b/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/source-map/lib/array-set.js b/node_modules/source-map/lib/array-set.js new file mode 100644 index 00000000..fbd5c81c --- /dev/null +++ b/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/source-map/lib/base64-vlq.js b/node_modules/source-map/lib/base64-vlq.js new file mode 100644 index 00000000..612b4040 --- /dev/null +++ b/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/source-map/lib/base64.js b/node_modules/source-map/lib/base64.js new file mode 100644 index 00000000..8aa86b30 --- /dev/null +++ b/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/source-map/lib/binary-search.js b/node_modules/source-map/lib/binary-search.js new file mode 100644 index 00000000..010ac941 --- /dev/null +++ b/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/source-map/lib/mapping-list.js b/node_modules/source-map/lib/mapping-list.js new file mode 100644 index 00000000..06d1274a --- /dev/null +++ b/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/source-map/lib/quick-sort.js b/node_modules/source-map/lib/quick-sort.js new file mode 100644 index 00000000..6a7caadb --- /dev/null +++ b/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/source-map/lib/source-map-consumer.js b/node_modules/source-map/lib/source-map-consumer.js new file mode 100644 index 00000000..6abcc280 --- /dev/null +++ b/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/source-map/lib/source-map-generator.js b/node_modules/source-map/lib/source-map-generator.js new file mode 100644 index 00000000..aff1e7fb --- /dev/null +++ b/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/source-map/lib/source-node.js b/node_modules/source-map/lib/source-node.js new file mode 100644 index 00000000..d196a53f --- /dev/null +++ b/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/source-map/lib/util.js b/node_modules/source-map/lib/util.js new file mode 100644 index 00000000..44e0e452 --- /dev/null +++ b/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/source-map/package.json b/node_modules/source-map/package.json new file mode 100644 index 00000000..897e4bd5 --- /dev/null +++ b/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": "/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": "/home/remi/github/CPP_BIDS/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/source-map/source-map.js b/node_modules/source-map/source-map.js new file mode 100644 index 00000000..bc88fe82 --- /dev/null +++ b/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/split-string/LICENSE b/node_modules/split-string/LICENSE new file mode 100644 index 00000000..e33d14b7 --- /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 00000000..d622e44d --- /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 00000000..7bc0ea91 --- /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 00000000..aa88f69c --- /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": [ + "/readdirp/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": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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/sprintf-js/.npmignore b/node_modules/sprintf-js/.npmignore new file mode 100644 index 00000000..096746c1 --- /dev/null +++ b/node_modules/sprintf-js/.npmignore @@ -0,0 +1 @@ +/node_modules/ \ No newline at end of file diff --git a/node_modules/sprintf-js/LICENSE b/node_modules/sprintf-js/LICENSE new file mode 100644 index 00000000..663ac52e --- /dev/null +++ b/node_modules/sprintf-js/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2007-2014, Alexandru Marasteanu +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 this software 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 AUTHORS OR COPYRIGHT HOLDERS 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/sprintf-js/README.md b/node_modules/sprintf-js/README.md new file mode 100644 index 00000000..83863561 --- /dev/null +++ b/node_modules/sprintf-js/README.md @@ -0,0 +1,88 @@ +# sprintf.js +**sprintf.js** is a complete open source JavaScript sprintf implementation for the *browser* and *node.js*. + +Its prototype is simple: + + string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]]) + +The placeholders in the format string are marked by `%` and are followed by one or more of these elements, in this order: + +* An optional number followed by a `$` sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string. +* An optional `+` sign that forces to preceed the result with a plus or minus sign on numeric values. By default, only the `-` sign is used on negative numbers. +* An optional padding specifier that says what character to use for padding (if specified). Possible values are `0` or any other character precedeed by a `'` (single quote). The default is to pad with *spaces*. +* An optional `-` sign, that causes sprintf to left-align the result of this placeholder. The default is to right-align the result. +* An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. When used with the `j` (JSON) type specifier, the padding length specifies the tab size used for indentation. +* An optional precision modifier, consisting of a `.` (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used with the `g` type specifier, it specifies the number of significant digits. When used on a string, it causes the result to be truncated. +* A type specifier that can be any of: + * `%` — yields a literal `%` character + * `b` — yields an integer as a binary number + * `c` — yields an integer as the character with that ASCII value + * `d` or `i` — yields an integer as a signed decimal number + * `e` — yields a float using scientific notation + * `u` — yields an integer as an unsigned decimal number + * `f` — yields a float as is; see notes on precision above + * `g` — yields a float as is; see notes on precision above + * `o` — yields an integer as an octal number + * `s` — yields a string as is + * `x` — yields an integer as a hexadecimal number (lower-case) + * `X` — yields an integer as a hexadecimal number (upper-case) + * `j` — yields a JavaScript object or array as a JSON encoded string + +## JavaScript `vsprintf` +`vsprintf` is the same as `sprintf` except that it accepts an array of arguments, rather than a variable number of arguments: + + vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"]) + +## Argument swapping +You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to: + + sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants") +And, of course, you can repeat the placeholders without having to increase the number of arguments. + +## Named arguments +Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - `(` and `)` - and begin with a keyword that refers to a key: + + var user = { + name: "Dolly" + } + sprintf("Hello %(name)s", user) // Hello Dolly +Keywords in replacement fields can be optionally followed by any number of keywords or indexes: + + var users = [ + {name: "Dolly"}, + {name: "Molly"}, + {name: "Polly"} + ] + sprintf("Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s", {users: users}) // Hello Dolly, Molly and Polly +Note: mixing positional and named placeholders is not (yet) supported + +## Computed values +You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on-the-fly. + + sprintf("Current timestamp: %d", Date.now) // Current timestamp: 1398005382890 + sprintf("Current date and time: %s", function() { return new Date().toString() }) + +# AngularJS +You can now use `sprintf` and `vsprintf` (also aliased as `fmt` and `vfmt` respectively) in your AngularJS projects. See `demo/`. + +# Installation + +## Via Bower + + bower install sprintf + +## Or as a node.js module + + npm install sprintf-js + +### Usage + + var sprintf = require("sprintf-js").sprintf, + vsprintf = require("sprintf-js").vsprintf + + sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants") + vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"]) + +# License + +**sprintf.js** is licensed under the terms of the 3-clause BSD license. diff --git a/node_modules/sprintf-js/bower.json b/node_modules/sprintf-js/bower.json new file mode 100644 index 00000000..d90a7598 --- /dev/null +++ b/node_modules/sprintf-js/bower.json @@ -0,0 +1,14 @@ +{ + "name": "sprintf", + "description": "JavaScript sprintf implementation", + "version": "1.0.3", + "main": "src/sprintf.js", + "license": "BSD-3-Clause-Clear", + "keywords": ["sprintf", "string", "formatting"], + "authors": ["Alexandru Marasteanu (http://alexei.ro/)"], + "homepage": "https://github.com/alexei/sprintf.js", + "repository": { + "type": "git", + "url": "git://github.com/alexei/sprintf.js.git" + } +} diff --git a/node_modules/sprintf-js/demo/angular.html b/node_modules/sprintf-js/demo/angular.html new file mode 100644 index 00000000..3559efd7 --- /dev/null +++ b/node_modules/sprintf-js/demo/angular.html @@ -0,0 +1,20 @@ + + + + + + + + +
{{ "%+010d"|sprintf:-123 }}
+
{{ "%+010d"|vsprintf:[-123] }}
+
{{ "%+010d"|fmt:-123 }}
+
{{ "%+010d"|vfmt:[-123] }}
+
{{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}
+
{{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}
+ + + + diff --git a/node_modules/sprintf-js/dist/angular-sprintf.min.js b/node_modules/sprintf-js/dist/angular-sprintf.min.js new file mode 100644 index 00000000..dbaf744d --- /dev/null +++ b/node_modules/sprintf-js/dist/angular-sprintf.min.js @@ -0,0 +1,4 @@ +/*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */ + +angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(a){return a("sprintf")}]).filter("vsprintf",function(){return function(a,b){return vsprintf(a,b)}}).filter("vfmt",["$filter",function(a){return a("vsprintf")}]); +//# sourceMappingURL=angular-sprintf.min.map \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/angular-sprintf.min.js.map b/node_modules/sprintf-js/dist/angular-sprintf.min.js.map new file mode 100644 index 00000000..055964c6 --- /dev/null +++ b/node_modules/sprintf-js/dist/angular-sprintf.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"} \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/angular-sprintf.min.map b/node_modules/sprintf-js/dist/angular-sprintf.min.map new file mode 100644 index 00000000..055964c6 --- /dev/null +++ b/node_modules/sprintf-js/dist/angular-sprintf.min.map @@ -0,0 +1 @@ +{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"} \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/sprintf.min.js b/node_modules/sprintf-js/dist/sprintf.min.js new file mode 100644 index 00000000..dc61e51a --- /dev/null +++ b/node_modules/sprintf-js/dist/sprintf.min.js @@ -0,0 +1,4 @@ +/*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */ + +!function(a){function b(){var a=arguments[0],c=b.cache;return c[a]&&c.hasOwnProperty(a)||(c[a]=b.parse(a)),b.format.call(null,c[a],arguments)}function c(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function d(a,b){return Array(b+1).join(a)}var e={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};b.format=function(a,f){var g,h,i,j,k,l,m,n=1,o=a.length,p="",q=[],r=!0,s="";for(h=0;o>h;h++)if(p=c(a[h]),"string"===p)q[q.length]=a[h];else if("array"===p){if(j=a[h],j[2])for(g=f[n],i=0;i=0),j[8]){case"b":g=g.toString(2);break;case"c":g=String.fromCharCode(g);break;case"d":case"i":g=parseInt(g,10);break;case"j":g=JSON.stringify(g,null,j[6]?parseInt(j[6]):0);break;case"e":g=j[7]?g.toExponential(j[7]):g.toExponential();break;case"f":g=j[7]?parseFloat(g).toFixed(j[7]):parseFloat(g);break;case"g":g=j[7]?parseFloat(g).toPrecision(j[7]):parseFloat(g);break;case"o":g=g.toString(8);break;case"s":g=(g=String(g))&&j[7]?g.substring(0,j[7]):g;break;case"u":g>>>=0;break;case"x":g=g.toString(16);break;case"X":g=g.toString(16).toUpperCase()}e.json.test(j[8])?q[q.length]=g:(!e.number.test(j[8])||r&&!j[3]?s="":(s=r?"+":"-",g=g.toString().replace(e.sign,"")),l=j[4]?"0"===j[4]?"0":j[4].charAt(1):" ",m=j[6]-(s+g).length,k=j[6]&&m>0?d(l,m):"",q[q.length]=j[5]?s+g+k:"0"===l?s+k+g:k+s+g)}return q.join("")},b.cache={},b.parse=function(a){for(var b=a,c=[],d=[],f=0;b;){if(null!==(c=e.text.exec(b)))d[d.length]=c[0];else if(null!==(c=e.modulo.exec(b)))d[d.length]="%";else{if(null===(c=e.placeholder.exec(b)))throw new SyntaxError("[sprintf] unexpected placeholder");if(c[2]){f|=1;var g=[],h=c[2],i=[];if(null===(i=e.key.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(g[g.length]=i[1];""!==(h=h.substring(i[0].length));)if(null!==(i=e.key_access.exec(h)))g[g.length]=i[1];else{if(null===(i=e.index_access.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");g[g.length]=i[1]}c[2]=g}else f|=2;if(3===f)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d[d.length]=c}b=b.substring(c[0].length)}return d};var f=function(a,c,d){return d=(c||[]).slice(0),d.splice(0,0,a),b.apply(null,d)};"undefined"!=typeof exports?(exports.sprintf=b,exports.vsprintf=f):(a.sprintf=b,a.vsprintf=f,"function"==typeof define&&define.amd&&define(function(){return{sprintf:b,vsprintf:f}}))}("undefined"==typeof window?this:window); +//# sourceMappingURL=sprintf.min.map \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/sprintf.min.js.map b/node_modules/sprintf-js/dist/sprintf.min.js.map new file mode 100644 index 00000000..369dbafa --- /dev/null +++ b/node_modules/sprintf-js/dist/sprintf.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA4JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GApLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,SACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYnC,EAASuB,EAAWG,IACd,WAAdS,EACAC,EAAOA,EAAOF,QAAUX,EAAWG,OAElC,IAAkB,UAAdS,EAAuB,CAE5B,GADAP,EAAQL,EAAWG,GACfE,EAAM,GAEN,IADAH,EAAMD,EAAKQ,GACNL,EAAI,EAAGA,EAAIC,EAAM,GAAGM,OAAQP,IAAK,CAClC,IAAKF,EAAI7B,eAAegC,EAAM,GAAGD,IAC7B,KAAM,IAAIW,OAAM9C,EAAQ,yCAA0CoC,EAAM,GAAGD,IAE/EF,GAAMA,EAAIG,EAAM,GAAGD,QAIvBF,GADKG,EAAM,GACLJ,EAAKI,EAAM,IAGXJ,EAAKQ,IAOf,IAJqB,YAAjBhC,EAASyB,KACTA,EAAMA,KAGNb,EAAGC,WAAW0B,KAAKX,EAAM,KAAOhB,EAAGI,SAASuB,KAAKX,EAAM,KAAyB,UAAjB5B,EAASyB,IAAoBe,MAAMf,GAClG,KAAM,IAAIgB,WAAUjD,EAAQ,0CAA2CQ,EAASyB,IAOpF,QAJIb,EAAGE,OAAOyB,KAAKX,EAAM,MACrBS,EAAcZ,GAAO,GAGjBG,EAAM,IACV,IAAK,IACDH,EAAMA,EAAIrB,SAAS,EACvB,MACA,KAAK,IACDqB,EAAMiB,OAAOC,aAAalB,EAC9B,MACA,KAAK,IACL,IAAK,IACDA,EAAMmB,SAASnB,EAAK,GACxB,MACA,KAAK,IACDA,EAAMoB,KAAKC,UAAUrB,EAAK,KAAMG,EAAM,GAAKgB,SAAShB,EAAM,IAAM,EACpE,MACA,KAAK,IACDH,EAAMG,EAAM,GAAKH,EAAIsB,cAAcnB,EAAM,IAAMH,EAAIsB,eACvD,MACA,KAAK,IACDtB,EAAMG,EAAM,GAAKoB,WAAWvB,GAAKwB,QAAQrB,EAAM,IAAMoB,WAAWvB,EACpE,MACA,KAAK,IACDA,EAAMA,EAAIrB,SAAS,EACvB,MACA,KAAK,IACDqB,GAAQA,EAAMiB,OAAOjB,KAASG,EAAM,GAAKH,EAAIyB,UAAU,EAAGtB,EAAM,IAAMH,CAC1E,MACA,KAAK,IACDA,KAAc,CAClB,MACA,KAAK,IACDA,EAAMA,EAAIrB,SAAS,GACvB,MACA,KAAK,IACDqB,EAAMA,EAAIrB,SAAS,IAAI+C,cAG3BvC,EAAGG,KAAKwB,KAAKX,EAAM,IACnBQ,EAAOA,EAAOF,QAAUT,IAGpBb,EAAGE,OAAOyB,KAAKX,EAAM,KAASS,IAAeT,EAAM,GAKnDN,EAAO,IAJPA,EAAOe,EAAc,IAAM,IAC3BZ,EAAMA,EAAIrB,WAAWgD,QAAQxC,EAAGU,KAAM,KAK1CQ,EAAgBF,EAAM,GAAkB,MAAbA,EAAM,GAAa,IAAMA,EAAM,GAAGyB,OAAO,GAAK,IACzEtB,EAAaH,EAAM,IAAMN,EAAOG,GAAKS,OACrCL,EAAMD,EAAM,IAAMG,EAAa,EAAIxB,EAAWuB,EAAeC,GAAoB,GACjFK,EAAOA,EAAOF,QAAUN,EAAM,GAAKN,EAAOG,EAAMI,EAAyB,MAAlBC,EAAwBR,EAAOO,EAAMJ,EAAMI,EAAMP,EAAOG,GAI3H,MAAOW,GAAOzB,KAAK,KAGvBnB,EAAQG,SAERH,EAAQK,MAAQ,SAASyD,GAErB,IADA,GAAIC,GAAOD,EAAK1B,KAAYL,KAAiBiC,EAAY,EAClDD,GAAM,CACT,GAAqC,QAAhC3B,EAAQhB,EAAGK,KAAKwC,KAAKF,IACtBhC,EAAWA,EAAWW,QAAUN,EAAM,OAErC,IAAuC,QAAlCA,EAAQhB,EAAGM,OAAOuC,KAAKF,IAC7BhC,EAAWA,EAAWW,QAAU,QAE/B,CAAA,GAA4C,QAAvCN,EAAQhB,EAAGO,YAAYsC,KAAKF,IAgClC,KAAM,IAAIG,aAAY,mCA/BtB,IAAI9B,EAAM,GAAI,CACV4B,GAAa,CACb,IAAIG,MAAiBC,EAAoBhC,EAAM,GAAIiC,IACnD,IAAuD,QAAlDA,EAAcjD,EAAGnB,IAAIgE,KAAKG,IAe3B,KAAM,IAAIF,aAAY,+CAbtB,KADAC,EAAWA,EAAWzB,QAAU2B,EAAY,GACwC,MAA5ED,EAAoBA,EAAkBV,UAAUW,EAAY,GAAG3B,UACnE,GAA8D,QAAzD2B,EAAcjD,EAAGQ,WAAWqC,KAAKG,IAClCD,EAAWA,EAAWzB,QAAU2B,EAAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAcjD,EAAGS,aAAaoC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAWzB,QAAU2B,EAAY,GAUxDjC,EAAM,GAAK+B,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAIlB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC2B,EAAOA,EAAKL,UAAUtB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIuC,GAAW,SAASR,EAAK9B,EAAMuC,GAG/B,MAFAA,IAASvC,OAAYnB,MAAM,GAC3B0D,EAAMC,OAAO,EAAG,EAAGV,GACZ9D,EAAQyE,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ1E,QAAUA,EAClB0E,QAAQJ,SAAWA,IAGnBvE,EAAOC,QAAUA,EACjBD,EAAOuE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI3E,QAASA,EACTsE,SAAUA,OAKT,mBAAXvE,QAAyB8E,KAAO9E"} \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/sprintf.min.map b/node_modules/sprintf-js/dist/sprintf.min.map new file mode 100644 index 00000000..ee011aaa --- /dev/null +++ b/node_modules/sprintf-js/dist/sprintf.min.map @@ -0,0 +1 @@ +{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","toPrecision","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA+JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GAvLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,UACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYnC,EAASuB,EAAWG,IACd,WAAdS,EACAC,EAAOA,EAAOF,QAAUX,EAAWG,OAElC,IAAkB,UAAdS,EAAuB,CAE5B,GADAP,EAAQL,EAAWG,GACfE,EAAM,GAEN,IADAH,EAAMD,EAAKQ,GACNL,EAAI,EAAGA,EAAIC,EAAM,GAAGM,OAAQP,IAAK,CAClC,IAAKF,EAAI7B,eAAegC,EAAM,GAAGD,IAC7B,KAAM,IAAIW,OAAM9C,EAAQ,yCAA0CoC,EAAM,GAAGD,IAE/EF,GAAMA,EAAIG,EAAM,GAAGD,QAIvBF,GADKG,EAAM,GACLJ,EAAKI,EAAM,IAGXJ,EAAKQ,IAOf,IAJqB,YAAjBhC,EAASyB,KACTA,EAAMA,KAGNb,EAAGC,WAAW0B,KAAKX,EAAM,KAAOhB,EAAGI,SAASuB,KAAKX,EAAM,KAAyB,UAAjB5B,EAASyB,IAAoBe,MAAMf,GAClG,KAAM,IAAIgB,WAAUjD,EAAQ,0CAA2CQ,EAASyB,IAOpF,QAJIb,EAAGE,OAAOyB,KAAKX,EAAM,MACrBS,EAAcZ,GAAO,GAGjBG,EAAM,IACV,IAAK,IACDH,EAAMA,EAAIrB,SAAS,EACvB,MACA,KAAK,IACDqB,EAAMiB,OAAOC,aAAalB,EAC9B,MACA,KAAK,IACL,IAAK,IACDA,EAAMmB,SAASnB,EAAK,GACxB,MACA,KAAK,IACDA,EAAMoB,KAAKC,UAAUrB,EAAK,KAAMG,EAAM,GAAKgB,SAAShB,EAAM,IAAM,EACpE,MACA,KAAK,IACDH,EAAMG,EAAM,GAAKH,EAAIsB,cAAcnB,EAAM,IAAMH,EAAIsB,eACvD,MACA,KAAK,IACDtB,EAAMG,EAAM,GAAKoB,WAAWvB,GAAKwB,QAAQrB,EAAM,IAAMoB,WAAWvB,EACpE,MACA,KAAK,IACDA,EAAMG,EAAM,GAAKoB,WAAWvB,GAAKyB,YAAYtB,EAAM,IAAMoB,WAAWvB,EACxE,MACA,KAAK,IACDA,EAAMA,EAAIrB,SAAS,EACvB,MACA,KAAK,IACDqB,GAAQA,EAAMiB,OAAOjB,KAASG,EAAM,GAAKH,EAAI0B,UAAU,EAAGvB,EAAM,IAAMH,CAC1E,MACA,KAAK,IACDA,KAAc,CAClB,MACA,KAAK,IACDA,EAAMA,EAAIrB,SAAS,GACvB,MACA,KAAK,IACDqB,EAAMA,EAAIrB,SAAS,IAAIgD,cAG3BxC,EAAGG,KAAKwB,KAAKX,EAAM,IACnBQ,EAAOA,EAAOF,QAAUT,IAGpBb,EAAGE,OAAOyB,KAAKX,EAAM,KAASS,IAAeT,EAAM,GAKnDN,EAAO,IAJPA,EAAOe,EAAc,IAAM,IAC3BZ,EAAMA,EAAIrB,WAAWiD,QAAQzC,EAAGU,KAAM,KAK1CQ,EAAgBF,EAAM,GAAkB,MAAbA,EAAM,GAAa,IAAMA,EAAM,GAAG0B,OAAO,GAAK,IACzEvB,EAAaH,EAAM,IAAMN,EAAOG,GAAKS,OACrCL,EAAMD,EAAM,IAAMG,EAAa,EAAIxB,EAAWuB,EAAeC,GAAoB,GACjFK,EAAOA,EAAOF,QAAUN,EAAM,GAAKN,EAAOG,EAAMI,EAAyB,MAAlBC,EAAwBR,EAAOO,EAAMJ,EAAMI,EAAMP,EAAOG,GAI3H,MAAOW,GAAOzB,KAAK,KAGvBnB,EAAQG,SAERH,EAAQK,MAAQ,SAAS0D,GAErB,IADA,GAAIC,GAAOD,EAAK3B,KAAYL,KAAiBkC,EAAY,EAClDD,GAAM,CACT,GAAqC,QAAhC5B,EAAQhB,EAAGK,KAAKyC,KAAKF,IACtBjC,EAAWA,EAAWW,QAAUN,EAAM,OAErC,IAAuC,QAAlCA,EAAQhB,EAAGM,OAAOwC,KAAKF,IAC7BjC,EAAWA,EAAWW,QAAU,QAE/B,CAAA,GAA4C,QAAvCN,EAAQhB,EAAGO,YAAYuC,KAAKF,IAgClC,KAAM,IAAIG,aAAY,mCA/BtB,IAAI/B,EAAM,GAAI,CACV6B,GAAa,CACb,IAAIG,MAAiBC,EAAoBjC,EAAM,GAAIkC,IACnD,IAAuD,QAAlDA,EAAclD,EAAGnB,IAAIiE,KAAKG,IAe3B,KAAM,IAAIF,aAAY,+CAbtB,KADAC,EAAWA,EAAW1B,QAAU4B,EAAY,GACwC,MAA5ED,EAAoBA,EAAkBV,UAAUW,EAAY,GAAG5B,UACnE,GAA8D,QAAzD4B,EAAclD,EAAGQ,WAAWsC,KAAKG,IAClCD,EAAWA,EAAW1B,QAAU4B,EAAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAclD,EAAGS,aAAaqC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAW1B,QAAU4B,EAAY,GAUxDlC,EAAM,GAAKgC,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAInB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC4B,EAAOA,EAAKL,UAAUvB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIwC,GAAW,SAASR,EAAK/B,EAAMwC,GAG/B,MAFAA,IAASxC,OAAYnB,MAAM,GAC3B2D,EAAMC,OAAO,EAAG,EAAGV,GACZ/D,EAAQ0E,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ3E,QAAUA,EAClB2E,QAAQJ,SAAWA,IAGnBxE,EAAOC,QAAUA,EACjBD,EAAOwE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI5E,QAASA,EACTuE,SAAUA,OAKT,mBAAXxE,QAAyB+E,KAAO/E"} \ No newline at end of file diff --git a/node_modules/sprintf-js/gruntfile.js b/node_modules/sprintf-js/gruntfile.js new file mode 100644 index 00000000..246e1c3b --- /dev/null +++ b/node_modules/sprintf-js/gruntfile.js @@ -0,0 +1,36 @@ +module.exports = function(grunt) { + grunt.initConfig({ + pkg: grunt.file.readJSON("package.json"), + + uglify: { + options: { + banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n", + sourceMap: true + }, + build: { + files: [ + { + src: "src/sprintf.js", + dest: "dist/sprintf.min.js" + }, + { + src: "src/angular-sprintf.js", + dest: "dist/angular-sprintf.min.js" + } + ] + } + }, + + watch: { + js: { + files: "src/*.js", + tasks: ["uglify"] + } + } + }) + + grunt.loadNpmTasks("grunt-contrib-uglify") + grunt.loadNpmTasks("grunt-contrib-watch") + + grunt.registerTask("default", ["uglify", "watch"]) +} diff --git a/node_modules/sprintf-js/package.json b/node_modules/sprintf-js/package.json new file mode 100644 index 00000000..fae35560 --- /dev/null +++ b/node_modules/sprintf-js/package.json @@ -0,0 +1,54 @@ +{ + "_from": "sprintf-js@~1.0.2", + "_id": "sprintf-js@1.0.3", + "_inBundle": false, + "_integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "_location": "/sprintf-js", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "sprintf-js@~1.0.2", + "name": "sprintf-js", + "escapedName": "sprintf-js", + "rawSpec": "~1.0.2", + "saveSpec": null, + "fetchSpec": "~1.0.2" + }, + "_requiredBy": [ + "/argparse" + ], + "_resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "_shasum": "04e6926f662895354f3dd015203633b857297e2c", + "_spec": "sprintf-js@~1.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/argparse", + "author": { + "name": "Alexandru Marasteanu", + "email": "hello@alexei.ro", + "url": "http://alexei.ro/" + }, + "bugs": { + "url": "https://github.com/alexei/sprintf.js/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "JavaScript sprintf implementation", + "devDependencies": { + "grunt": "*", + "grunt-contrib-uglify": "*", + "grunt-contrib-watch": "*", + "mocha": "*" + }, + "homepage": "https://github.com/alexei/sprintf.js#readme", + "license": "BSD-3-Clause", + "main": "src/sprintf.js", + "name": "sprintf-js", + "repository": { + "type": "git", + "url": "git+https://github.com/alexei/sprintf.js.git" + }, + "scripts": { + "test": "mocha test/test.js" + }, + "version": "1.0.3" +} diff --git a/node_modules/sprintf-js/src/angular-sprintf.js b/node_modules/sprintf-js/src/angular-sprintf.js new file mode 100644 index 00000000..9c69123b --- /dev/null +++ b/node_modules/sprintf-js/src/angular-sprintf.js @@ -0,0 +1,18 @@ +angular. + module("sprintf", []). + filter("sprintf", function() { + return function() { + return sprintf.apply(null, arguments) + } + }). + filter("fmt", ["$filter", function($filter) { + return $filter("sprintf") + }]). + filter("vsprintf", function() { + return function(format, argv) { + return vsprintf(format, argv) + } + }). + filter("vfmt", ["$filter", function($filter) { + return $filter("vsprintf") + }]) diff --git a/node_modules/sprintf-js/src/sprintf.js b/node_modules/sprintf-js/src/sprintf.js new file mode 100644 index 00000000..c0fc7c08 --- /dev/null +++ b/node_modules/sprintf-js/src/sprintf.js @@ -0,0 +1,208 @@ +(function(window) { + var re = { + not_string: /[^s]/, + number: /[diefg]/, + json: /[j]/, + not_json: /[^j]/, + text: /^[^\x25]+/, + modulo: /^\x25{2}/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/, + key: /^([a-z_][a-z_\d]*)/i, + key_access: /^\.([a-z_][a-z_\d]*)/i, + index_access: /^\[(\d+)\]/, + sign: /^[\+\-]/ + } + + function sprintf() { + var key = arguments[0], cache = sprintf.cache + if (!(cache[key] && cache.hasOwnProperty(key))) { + cache[key] = sprintf.parse(key) + } + return sprintf.format.call(null, cache[key], arguments) + } + + sprintf.format = function(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" + for (i = 0; i < tree_length; i++) { + node_type = get_type(parse_tree[i]) + if (node_type === "string") { + output[output.length] = parse_tree[i] + } + else if (node_type === "array") { + match = parse_tree[i] // convenience purposes only + if (match[2]) { // keyword argument + arg = argv[cursor] + for (k = 0; k < match[2].length; k++) { + if (!arg.hasOwnProperty(match[2][k])) { + throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) + } + arg = arg[match[2][k]] + } + } + else if (match[1]) { // positional argument (explicit) + arg = argv[match[1]] + } + else { // positional argument (implicit) + arg = argv[cursor++] + } + + if (get_type(arg) == "function") { + arg = arg() + } + + if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { + throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) + } + + if (re.number.test(match[8])) { + is_positive = arg >= 0 + } + + switch (match[8]) { + case "b": + arg = arg.toString(2) + break + case "c": + arg = String.fromCharCode(arg) + break + case "d": + case "i": + arg = parseInt(arg, 10) + break + case "j": + arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) + break + case "e": + arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() + break + case "f": + arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) + break + case "g": + arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg) + break + case "o": + arg = arg.toString(8) + break + case "s": + arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) + break + case "u": + arg = arg >>> 0 + break + case "x": + arg = arg.toString(16) + break + case "X": + arg = arg.toString(16).toUpperCase() + break + } + if (re.json.test(match[8])) { + output[output.length] = arg + } + else { + if (re.number.test(match[8]) && (!is_positive || match[3])) { + sign = is_positive ? "+" : "-" + arg = arg.toString().replace(re.sign, "") + } + else { + sign = "" + } + pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " + pad_length = match[6] - (sign + arg).length + pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" + output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) + } + } + } + return output.join("") + } + + sprintf.cache = {} + + sprintf.parse = function(fmt) { + var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 + while (_fmt) { + if ((match = re.text.exec(_fmt)) !== null) { + parse_tree[parse_tree.length] = match[0] + } + else if ((match = re.modulo.exec(_fmt)) !== null) { + parse_tree[parse_tree.length] = "%" + } + else if ((match = re.placeholder.exec(_fmt)) !== null) { + if (match[2]) { + arg_names |= 1 + var field_list = [], replacement_field = match[2], field_match = [] + if ((field_match = re.key.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { + if ((field_match = re.key_access.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + } + else if ((field_match = re.index_access.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + } + else { + throw new SyntaxError("[sprintf] failed to parse named argument key") + } + } + } + else { + throw new SyntaxError("[sprintf] failed to parse named argument key") + } + match[2] = field_list + } + else { + arg_names |= 2 + } + if (arg_names === 3) { + throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") + } + parse_tree[parse_tree.length] = match + } + else { + throw new SyntaxError("[sprintf] unexpected placeholder") + } + _fmt = _fmt.substring(match[0].length) + } + return parse_tree + } + + var vsprintf = function(fmt, argv, _argv) { + _argv = (argv || []).slice(0) + _argv.splice(0, 0, fmt) + return sprintf.apply(null, _argv) + } + + /** + * helpers + */ + function get_type(variable) { + return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() + } + + function str_repeat(input, multiplier) { + return Array(multiplier + 1).join(input) + } + + /** + * export to either browser or node.js + */ + if (typeof exports !== "undefined") { + exports.sprintf = sprintf + exports.vsprintf = vsprintf + } + else { + window.sprintf = sprintf + window.vsprintf = vsprintf + + if (typeof define === "function" && define.amd) { + define(function() { + return { + sprintf: sprintf, + vsprintf: vsprintf + } + }) + } + } +})(typeof window === "undefined" ? this : window); diff --git a/node_modules/sprintf-js/test/test.js b/node_modules/sprintf-js/test/test.js new file mode 100644 index 00000000..6f57b253 --- /dev/null +++ b/node_modules/sprintf-js/test/test.js @@ -0,0 +1,82 @@ +var assert = require("assert"), + sprintfjs = require("../src/sprintf.js"), + sprintf = sprintfjs.sprintf, + vsprintf = sprintfjs.vsprintf + +describe("sprintfjs", function() { + var pi = 3.141592653589793 + + it("should return formated strings for simple placeholders", function() { + assert.equal("%", sprintf("%%")) + assert.equal("10", sprintf("%b", 2)) + assert.equal("A", sprintf("%c", 65)) + assert.equal("2", sprintf("%d", 2)) + assert.equal("2", sprintf("%i", 2)) + assert.equal("2", sprintf("%d", "2")) + assert.equal("2", sprintf("%i", "2")) + assert.equal('{"foo":"bar"}', sprintf("%j", {foo: "bar"})) + assert.equal('["foo","bar"]', sprintf("%j", ["foo", "bar"])) + assert.equal("2e+0", sprintf("%e", 2)) + assert.equal("2", sprintf("%u", 2)) + assert.equal("4294967294", sprintf("%u", -2)) + assert.equal("2.2", sprintf("%f", 2.2)) + assert.equal("3.141592653589793", sprintf("%g", pi)) + assert.equal("10", sprintf("%o", 8)) + assert.equal("%s", sprintf("%s", "%s")) + assert.equal("ff", sprintf("%x", 255)) + assert.equal("FF", sprintf("%X", 255)) + assert.equal("Polly wants a cracker", sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")) + assert.equal("Hello world!", sprintf("Hello %(who)s!", {"who": "world"})) + }) + + it("should return formated strings for complex placeholders", function() { + // sign + assert.equal("2", sprintf("%d", 2)) + assert.equal("-2", sprintf("%d", -2)) + assert.equal("+2", sprintf("%+d", 2)) + assert.equal("-2", sprintf("%+d", -2)) + assert.equal("2", sprintf("%i", 2)) + assert.equal("-2", sprintf("%i", -2)) + assert.equal("+2", sprintf("%+i", 2)) + assert.equal("-2", sprintf("%+i", -2)) + assert.equal("2.2", sprintf("%f", 2.2)) + assert.equal("-2.2", sprintf("%f", -2.2)) + assert.equal("+2.2", sprintf("%+f", 2.2)) + assert.equal("-2.2", sprintf("%+f", -2.2)) + assert.equal("-2.3", sprintf("%+.1f", -2.34)) + assert.equal("-0.0", sprintf("%+.1f", -0.01)) + assert.equal("3.14159", sprintf("%.6g", pi)) + assert.equal("3.14", sprintf("%.3g", pi)) + assert.equal("3", sprintf("%.1g", pi)) + assert.equal("-000000123", sprintf("%+010d", -123)) + assert.equal("______-123", sprintf("%+'_10d", -123)) + assert.equal("-234.34 123.2", sprintf("%f %f", -234.34, 123.2)) + + // padding + assert.equal("-0002", sprintf("%05d", -2)) + assert.equal("-0002", sprintf("%05i", -2)) + assert.equal(" <", sprintf("%5s", "<")) + assert.equal("0000<", sprintf("%05s", "<")) + assert.equal("____<", sprintf("%'_5s", "<")) + assert.equal("> ", sprintf("%-5s", ">")) + assert.equal(">0000", sprintf("%0-5s", ">")) + assert.equal(">____", sprintf("%'_-5s", ">")) + assert.equal("xxxxxx", sprintf("%5s", "xxxxxx")) + assert.equal("1234", sprintf("%02u", 1234)) + assert.equal(" -10.235", sprintf("%8.3f", -10.23456)) + assert.equal("-12.34 xxx", sprintf("%f %s", -12.34, "xxx")) + assert.equal('{\n "foo": "bar"\n}', sprintf("%2j", {foo: "bar"})) + assert.equal('[\n "foo",\n "bar"\n]', sprintf("%2j", ["foo", "bar"])) + + // precision + assert.equal("2.3", sprintf("%.1f", 2.345)) + assert.equal("xxxxx", sprintf("%5.5s", "xxxxxx")) + assert.equal(" x", sprintf("%5.1s", "xxxxxx")) + + }) + + it("should return formated strings for callbacks", function() { + assert.equal("foobar", sprintf("%s", function() { return "foobar" })) + assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass... + }) +}) diff --git a/node_modules/state-toggle/index.js b/node_modules/state-toggle/index.js new file mode 100644 index 00000000..aceee00d --- /dev/null +++ b/node_modules/state-toggle/index.js @@ -0,0 +1,23 @@ +'use strict' + +module.exports = factory + +// Construct a state `toggler`: a function which inverses `property` in context +// based on its current value. +// The by `toggler` returned function restores that value. +function factory(key, state, ctx) { + return enter + + function enter() { + var context = ctx || this + var current = context[key] + + context[key] = !state + + return exit + + function exit() { + context[key] = current + } + } +} diff --git a/node_modules/state-toggle/license b/node_modules/state-toggle/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/state-toggle/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/state-toggle/package.json b/node_modules/state-toggle/package.json new file mode 100644 index 00000000..3344709b --- /dev/null +++ b/node_modules/state-toggle/package.json @@ -0,0 +1,110 @@ +{ + "_from": "state-toggle@^1.0.0", + "_id": "state-toggle@1.0.3", + "_inBundle": false, + "_integrity": "sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==", + "_location": "/state-toggle", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "state-toggle@^1.0.0", + "name": "state-toggle", + "escapedName": "state-toggle", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse", + "/remark-stringify" + ], + "_resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz", + "_shasum": "e123b16a88e143139b09c6852221bc9815917dfe", + "_spec": "state-toggle@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/state-toggle/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Enter/exit a state", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.25.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "homepage": "https://github.com/wooorm/state-toggle#readme", + "keywords": [ + "enter", + "exit", + "state" + ], + "license": "MIT", + "name": "state-toggle", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/state-toggle.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s stateToggle -o state-toggle.js", + "build-mangle": "browserify . -s stateToggle -p tinyify -o state-toggle.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.3", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "state-toggle.js" + ] + } +} diff --git a/node_modules/state-toggle/readme.md b/node_modules/state-toggle/readme.md new file mode 100644 index 00000000..9fcca1e5 --- /dev/null +++ b/node_modules/state-toggle/readme.md @@ -0,0 +1,95 @@ +# state-toggle + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Enter/exit a state. + +## Install + +[npm][]: + +```sh +npm install state-toggle +``` + +## Use + +```js +var toggle = require('state-toggle') + +var ctx = {on: false} +var enter = toggle('on', ctx.on, ctx) +var exit + +// Entering: +exit = enter() +console.log(ctx.on) // => true + +// Exiting: +exit() +console.log(ctx.on) // => false +``` + +## API + +### `toggle(key, initial[, ctx])` + +Create a toggle, which when entering toggles `key` on `ctx` (or `this`, if `ctx` +is not given) to `!initial`, and when exiting, sets `key` on the context back to +the value it had before entering. + +###### Returns + +`Function` — [`enter`][enter]. + +### `enter()` + +Enter the state. + +###### Context + +If no `ctx` was given to `toggle`, the context object (`this`) of `enter()` is +used to toggle. + +###### Returns + +`Function` — [`exit`][exit]. + +### `exit()` + +Exit the state, reverting `key` to the value it had before entering. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/state-toggle.svg + +[build]: https://travis-ci.org/wooorm/state-toggle + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/state-toggle.svg + +[coverage]: https://codecov.io/github/wooorm/state-toggle + +[downloads-badge]: https://img.shields.io/npm/dm/state-toggle.svg + +[downloads]: https://www.npmjs.com/package/state-toggle + +[size-badge]: https://img.shields.io/bundlephobia/minzip/state-toggle.svg + +[size]: https://bundlephobia.com/result?p=state-toggle + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[enter]: #enter + +[exit]: #exit diff --git a/node_modules/static-extend/LICENSE b/node_modules/static-extend/LICENSE new file mode 100644 index 00000000..e28e6032 --- /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 00000000..f4124b2a --- /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 00000000..65f90aca --- /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 00000000..8cac698a --- /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 00000000..3e0e5e13 --- /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 00000000..0a0686b2 --- /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": "/home/remi/github/CPP_BIDS/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/package.json b/node_modules/static-extend/package.json new file mode 100644 index 00000000..163ff59b --- /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-descriptor": "0.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": "/home/remi/github/CPP_BIDS/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/string-width/index.js b/node_modules/string-width/index.js new file mode 100644 index 00000000..b9bec624 --- /dev/null +++ b/node_modules/string-width/index.js @@ -0,0 +1,37 @@ +'use strict'; +var stripAnsi = require('strip-ansi'); +var codePointAt = require('code-point-at'); +var isFullwidthCodePoint = require('is-fullwidth-code-point'); + +// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345 +module.exports = function (str) { + if (typeof str !== 'string' || str.length === 0) { + return 0; + } + + var width = 0; + + str = stripAnsi(str); + + for (var i = 0; i < str.length; i++) { + var code = codePointAt(str, i); + + // ignore control characters + if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) { + continue; + } + + // surrogates + if (code >= 0x10000) { + i++; + } + + if (isFullwidthCodePoint(code)) { + width += 2; + } else { + width++; + } + } + + return width; +}; diff --git a/node_modules/string-width/license b/node_modules/string-width/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/string-width/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/string-width/package.json b/node_modules/string-width/package.json new file mode 100644 index 00000000..dd3976ce --- /dev/null +++ b/node_modules/string-width/package.json @@ -0,0 +1,88 @@ +{ + "_from": "string-width@^1.0.0", + "_id": "string-width@1.0.2", + "_inBundle": false, + "_integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "_location": "/string-width", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "string-width@^1.0.0", + "name": "string-width", + "escapedName": "string-width", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/vfile-reporter" + ], + "_resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "_shasum": "118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3", + "_spec": "string-width@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/vfile-reporter", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/string-width/issues" + }, + "bundleDependencies": false, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.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": ">=0.10.0" + }, + "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": "1.0.2" +} diff --git a/node_modules/string-width/readme.md b/node_modules/string-width/readme.md new file mode 100644 index 00000000..1ab42c93 --- /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](http://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 --save 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/.travis.yml b/node_modules/string_decoder/.travis.yml new file mode 100644 index 00000000..3347a725 --- /dev/null +++ b/node_modules/string_decoder/.travis.yml @@ -0,0 +1,50 @@ +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 diff --git a/node_modules/string_decoder/LICENSE b/node_modules/string_decoder/LICENSE new file mode 100644 index 00000000..778edb20 --- /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 00000000..5fd58315 --- /dev/null +++ b/node_modules/string_decoder/README.md @@ -0,0 +1,47 @@ +# string_decoder + +***Node-core v8.9.4 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_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/v8.9.4/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. + +## Streams Working Group + +`string_decoder` 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. + +See [readable-stream](https://github.com/nodejs/readable-stream) for +more details. 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 00000000..2e89e63f --- /dev/null +++ b/node_modules/string_decoder/lib/string_decoder.js @@ -0,0 +1,296 @@ +// 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 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. If an invalid byte is detected, -2 is returned. +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 byte >> 6 === 0x02 ? -1 : -2; +} + +// 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 || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) 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 +// a single UTF-8 replacement character ('\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'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// 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 is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + 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 00000000..121a78fe --- /dev/null +++ b/node_modules/string_decoder/package.json @@ -0,0 +1,59 @@ +{ + "_from": "string_decoder@~1.1.1", + "_id": "string_decoder@1.1.1", + "_inBundle": false, + "_integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "_location": "/string_decoder", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "string_decoder@~1.1.1", + "name": "string_decoder", + "escapedName": "string_decoder", + "rawSpec": "~1.1.1", + "saveSpec": null, + "fetchSpec": "~1.1.1" + }, + "_requiredBy": [ + "/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "_shasum": "9cf1611ba62685d7030ae9e4ba34149c3af03fc8", + "_spec": "string_decoder@~1.1.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readable-stream", + "bugs": { + "url": "https://github.com/nodejs/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", + "core-util-is": "^1.0.2", + "inherits": "^2.0.3", + "tap": "~0.4.8" + }, + "homepage": "https://github.com/nodejs/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT", + "main": "lib/string_decoder.js", + "name": "string_decoder", + "repository": { + "type": "git", + "url": "git://github.com/nodejs/string_decoder.git" + }, + "scripts": { + "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js", + "test": "tap test/parallel/*.js && node test/verify-dependencies" + }, + "version": "1.1.1" +} diff --git a/node_modules/stringify-entities/LICENSE b/node_modules/stringify-entities/LICENSE new file mode 100644 index 00000000..611b6758 --- /dev/null +++ b/node_modules/stringify-entities/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/stringify-entities/dangerous.json b/node_modules/stringify-entities/dangerous.json new file mode 100644 index 00000000..9147982c --- /dev/null +++ b/node_modules/stringify-entities/dangerous.json @@ -0,0 +1,10 @@ +[ + "cent", + "copy", + "divide", + "gt", + "lt", + "not", + "para", + "times" +] diff --git a/node_modules/stringify-entities/index.js b/node_modules/stringify-entities/index.js new file mode 100644 index 00000000..2f55802b --- /dev/null +++ b/node_modules/stringify-entities/index.js @@ -0,0 +1,134 @@ +'use strict' + +var entities = require('character-entities-html4') +var legacy = require('character-entities-legacy') +var hexadecimal = require('is-hexadecimal') +var alphanumerical = require('is-alphanumerical') +var dangerous = require('./dangerous.json') + +/* Expose. */ +module.exports = encode +encode.escape = escape + +var own = {}.hasOwnProperty + +/* List of enforced escapes. */ +var escapes = ['"', "'", '<', '>', '&', '`'] + +/* Map of characters to names. */ +var characters = construct() + +/* Default escapes. */ +var defaultEscapes = toExpression(escapes) + +/* Surrogate pairs. */ +var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g + +/* Non-ASCII characters. */ +// eslint-disable-next-line no-control-regex, unicorn/no-hex-escape +var bmp = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g + +/* Encode special characters in `value`. */ +function encode(value, options) { + var settings = options || {} + var subset = settings.subset + var set = subset ? toExpression(subset) : defaultEscapes + var escapeOnly = settings.escapeOnly + var omit = settings.omitOptionalSemicolons + + value = value.replace(set, function(char, pos, val) { + return one(char, val.charAt(pos + 1), settings) + }) + + if (subset || escapeOnly) { + return value + } + + return value + .replace(surrogatePair, replaceSurrogatePair) + .replace(bmp, replaceBmp) + + function replaceSurrogatePair(pair, pos, val) { + return toHexReference( + (pair.charCodeAt(0) - 0xd800) * 0x400 + + pair.charCodeAt(1) - + 0xdc00 + + 0x10000, + val.charAt(pos + 2), + omit + ) + } + + function replaceBmp(char, pos, val) { + return one(char, val.charAt(pos + 1), settings) + } +} + +/* Shortcut to escape special characters in HTML. */ +function escape(value) { + return encode(value, { + escapeOnly: true, + useNamedReferences: true + }) +} + +/* Encode `char` according to `options`. */ +function one(char, next, options) { + var shortest = options.useShortestReferences + var omit = options.omitOptionalSemicolons + var named + var numeric + + if ((shortest || options.useNamedReferences) && own.call(characters, char)) { + named = toNamed(characters[char], next, omit, options.attribute) + } + + if (shortest || !named) { + numeric = toHexReference(char.charCodeAt(0), next, omit) + } + + if (named && (!shortest || named.length < numeric.length)) { + return named + } + + return numeric +} + +/* Transform `code` into an entity. */ +function toNamed(name, next, omit, attribute) { + var value = '&' + name + + if ( + omit && + own.call(legacy, name) && + dangerous.indexOf(name) === -1 && + (!attribute || (next && next !== '=' && !alphanumerical(next))) + ) { + return value + } + + return value + ';' +} + +/* Transform `code` into a hexadecimal character reference. */ +function toHexReference(code, next, omit) { + var value = '&#x' + code.toString(16).toUpperCase() + return omit && next && !hexadecimal(next) ? value : value + ';' +} + +/* Create an expression for `characters`. */ +function toExpression(characters) { + return new RegExp('[' + characters.join('') + ']', 'g') +} + +/* Construct the map. */ +function construct() { + var chars = {} + var name + + for (name in entities) { + chars[entities[name]] = name + } + + return chars +} diff --git a/node_modules/stringify-entities/package.json b/node_modules/stringify-entities/package.json new file mode 100644 index 00000000..c63daebb --- /dev/null +++ b/node_modules/stringify-entities/package.json @@ -0,0 +1,123 @@ +{ + "_from": "stringify-entities@^1.0.1", + "_id": "stringify-entities@1.3.2", + "_inBundle": false, + "_integrity": "sha512-nrBAQClJAPN2p+uGCVJRPIPakKeKWZ9GtBCmormE7pWOSlHat7+x5A8gx85M7HM5Dt0BP3pP5RhVW77WdbJJ3A==", + "_location": "/stringify-entities", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "stringify-entities@^1.0.1", + "name": "stringify-entities", + "escapedName": "stringify-entities", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/remark-stringify" + ], + "_resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz", + "_shasum": "a98417e5471fd227b3e45d3db1861c11caf668f7", + "_spec": "stringify-entities@^1.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-stringify", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/stringify-entities/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "character-entities-html4": "^1.0.0", + "character-entities-legacy": "^1.0.0", + "is-alphanumerical": "^1.0.0", + "is-hexadecimal": "^1.0.0" + }, + "deprecated": false, + "description": "Encode HTML character references and character entities", + "devDependencies": { + "browserify": "^16.0.0", + "character-entities": "^1.0.0", + "esmangle": "^1.0.0", + "nyc": "^11.0.0", + "remark-cli": "^5.0.0", + "remark-preset-wooorm": "^4.0.0", + "tape": "^4.0.0", + "xo": "^0.20.0" + }, + "files": [ + "dangerous.json", + "index.js" + ], + "homepage": "https://github.com/wooorm/stringify-entities#readme", + "keywords": [ + "stringify", + "encode", + "escape", + "html", + "character", + "reference", + "entity", + "entities" + ], + "license": "MIT", + "name": "stringify-entities", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/stringify-entities.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s stringifyEntities > stringify-entities.js", + "build-mangle": "esmangle stringify-entities.js > stringify-entities.min.js", + "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", + "generate": "node build", + "test": "npm run generate && npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.3.2", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "no-var": "off", + "unicorn/number-literal-case": "off", + "prefer-arrow-callback": "off", + "guard-for-in": "off" + }, + "ignores": [ + "stringify-entities.js" + ] + } +} diff --git a/node_modules/stringify-entities/readme.md b/node_modules/stringify-entities/readme.md new file mode 100644 index 00000000..08f64360 --- /dev/null +++ b/node_modules/stringify-entities/readme.md @@ -0,0 +1,131 @@ +# stringify-entities [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] + +Encode HTML character references and character entities. + +* [x] Very fast +* [x] Just the encoding part +* [x] Reliable: ``'`'`` characters are escaped to ensure no scripts + run in IE6-8. Additionally, only named entities recognised by HTML4 + are encoded, meaning the infamous `'` (which people think is a + [virus][]) won’t show up + +## Algorithm + +By default, all dangerous, non-ASCII, or non-printable ASCII characters +are encoded. A [subset][] of characters can be given to encode just +those characters. Alternatively, pass [`escapeOnly`][escapeonly] to +escape just the dangerous characters (`"`, `'`, `<`, `>`, `&`, `` ` ``). +By default, numeric entities are used. Pass [`useNamedReferences`][named] +to use named entities when possible, or [`useShortestReferences`][short] +to use them if that results in less bytes. + +## Installation + +[npm][]: + +```bash +npm install stringify-entities +``` + +## Usage + +```js +var stringify = require('stringify-entities') + +stringify('alpha © bravo ≠ charlie 𝌆 delta') +// => 'alpha © bravo ≠ charlie 𝌆 delta' + +stringify('alpha © bravo ≠ charlie 𝌆 delta', {useNamedReferences: true}) +// => 'alpha © bravo ≠ charlie 𝌆 delta' +``` + +## API + +### `stringifyEntities(value[, options])` + +Encode special characters in `value`. + +##### `options` + +###### `options.escapeOnly` + +Whether to only escape possibly dangerous characters (`boolean`, +default: `false`). Those characters are `"`, `'`, `<`, `>` `&`, and +`` ` ``. + +###### `options.subset` + +Whether to only escape the given subset of characters (`Array.`). + +###### `options.useNamedReferences` + +Whether to use named entities where possible (`boolean?`, default: +`false`). + +###### `options.useShortestReferences` + +Whether to use named entities, where possible, if that results in less +bytes (`boolean?`, default: `false`). **Note**: `useNamedReferences` +can be omitted when using `useShortestReferences`. + +###### `options.omitOptionalSemicolons` + +Whether to omit semi-colons when possible (`boolean?`, default: `false`). +**Note**: This creates parse errors: don’t use this except when building +a minifier. + +Omitting semi-colons is possible for [certain][dangerous] [legacy][] +named references, and numeric entities, in some cases. + +###### `options.attribute` + +Only needed when operating dangerously with `omitOptionalSemicolons: true`. +Create entities which don’t fail in attributes (`boolean?`, default: +`false`). + +## Related + +* [`parse-entities`](https://github.com/wooorm/parse-entities) + — Parse HTML character references +* [`character-entities`](https://github.com/wooorm/character-entities) + — Info on character entities +* [`character-entities-html4`](https://github.com/wooorm/character-entities-html4) + — Info on HTML4 character entities +* [`character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) + — Info on legacy character entities +* [`character-reference-invalid`](https://github.com/wooorm/character-reference-invalid) + — Info on invalid numeric character references + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/stringify-entities.svg + +[build-status]: https://travis-ci.org/wooorm/stringify-entities + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/stringify-entities.svg + +[coverage-status]: https://codecov.io/github/wooorm/stringify-entities + +[license]: LICENSE + +[author]: http://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[virus]: http://www.telegraph.co.uk/technology/advice/10516839/Why-do-some-apostrophes-get-replaced-with-andapos.html + +[dangerous]: dangerous.json + +[legacy]: https://github.com/wooorm/character-entities-legacy + +[subset]: #optionssubset + +[escapeonly]: #optionsescapeonly + +[named]: #optionsusenamedreferences + +[short]: #optionsuseshortestreferences diff --git a/node_modules/strip-ansi/index.js b/node_modules/strip-ansi/index.js new file mode 100644 index 00000000..099480fb --- /dev/null +++ b/node_modules/strip-ansi/index.js @@ -0,0 +1,6 @@ +'use strict'; +var ansiRegex = require('ansi-regex')(); + +module.exports = function (str) { + return typeof str === 'string' ? str.replace(ansiRegex, '') : str; +}; diff --git a/node_modules/strip-ansi/license b/node_modules/strip-ansi/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/strip-ansi/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-ansi/package.json b/node_modules/strip-ansi/package.json new file mode 100644 index 00000000..9b273728 --- /dev/null +++ b/node_modules/strip-ansi/package.json @@ -0,0 +1,101 @@ +{ + "_from": "strip-ansi@^3.0.0", + "_id": "strip-ansi@3.0.1", + "_inBundle": false, + "_integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "_location": "/strip-ansi", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "strip-ansi@^3.0.0", + "name": "strip-ansi", + "escapedName": "strip-ansi", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/string-width" + ], + "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "_shasum": "6a385fb8853d952d5ff05d0e8aaf94278dc63dcf", + "_spec": "strip-ansi@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/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": "^2.0.0" + }, + "deprecated": false, + "description": "Strip ANSI escape codes", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/chalk/strip-ansi#readme", + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "license": "MIT", + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + { + "name": "Joshua Boy Nicolai Appelman", + "email": "joshua@jbna.nl", + "url": "jbna.nl" + }, + { + "name": "JD Ballard", + "email": "i.am.qix@gmail.com", + "url": "github.com/qix-" + } + ], + "name": "strip-ansi", + "repository": { + "type": "git", + "url": "git+https://github.com/chalk/strip-ansi.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "3.0.1" +} diff --git a/node_modules/strip-ansi/readme.md b/node_modules/strip-ansi/readme.md new file mode 100644 index 00000000..cb7d9ff7 --- /dev/null +++ b/node_modules/strip-ansi/readme.md @@ -0,0 +1,33 @@ +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) + +> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install --save strip-ansi +``` + + +## Usage + +```js +var stripAnsi = require('strip-ansi'); + +stripAnsi('\u001b[4mcake\u001b[0m'); +//=> 'cake' +``` + + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/strip-json-comments/index.js b/node_modules/strip-json-comments/index.js new file mode 100644 index 00000000..4e6576e6 --- /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 00000000..654d0bfe --- /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 00000000..44dda35a --- /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": "/home/remi/github/CPP_BIDS/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 00000000..0ee58dfe --- /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 00000000..62afa3a7 --- /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 00000000..1704131b --- /dev/null +++ b/node_modules/supports-color/index.js @@ -0,0 +1,131 @@ +'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) { + 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|^vt220|^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 00000000..e7af2f77 --- /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 00000000..61f228c8 --- /dev/null +++ b/node_modules/supports-color/package.json @@ -0,0 +1,85 @@ +{ + "_from": "supports-color@^5.3.0", + "_id": "supports-color@5.5.0", + "_inBundle": false, + "_integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "_location": "/supports-color", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "supports-color@^5.3.0", + "name": "supports-color", + "escapedName": "supports-color", + "rawSpec": "^5.3.0", + "saveSpec": null, + "fetchSpec": "^5.3.0" + }, + "_requiredBy": [ + "/chalk" + ], + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "_shasum": "e2e69a44ac8772f78a1ec0b35b689df6530efc8f", + "_spec": "supports-color@^5.3.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/chalk", + "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": "^0.25.0", + "import-fresh": "^2.0.0", + "xo": "^0.20.0" + }, + "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.5.0" +} diff --git a/node_modules/supports-color/readme.md b/node_modules/supports-color/readme.md new file mode 100644 index 00000000..f6e40195 --- /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/text-table/.travis.yml b/node_modules/text-table/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/text-table/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/text-table/LICENSE b/node_modules/text-table/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/text-table/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/text-table/example/align.js b/node_modules/text-table/example/align.js new file mode 100644 index 00000000..9be43098 --- /dev/null +++ b/node_modules/text-table/example/align.js @@ -0,0 +1,8 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] +], { align: [ 'l', 'r' ] }); +console.log(t); diff --git a/node_modules/text-table/example/center.js b/node_modules/text-table/example/center.js new file mode 100644 index 00000000..52b1c69e --- /dev/null +++ b/node_modules/text-table/example/center.js @@ -0,0 +1,8 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] +], { align: [ 'l', 'c', 'l' ] }); +console.log(t); diff --git a/node_modules/text-table/example/dotalign.js b/node_modules/text-table/example/dotalign.js new file mode 100644 index 00000000..2cea6299 --- /dev/null +++ b/node_modules/text-table/example/dotalign.js @@ -0,0 +1,9 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] +], { align: [ 'l', '.' ] }); +console.log(t); diff --git a/node_modules/text-table/example/doubledot.js b/node_modules/text-table/example/doubledot.js new file mode 100644 index 00000000..bab983b6 --- /dev/null +++ b/node_modules/text-table/example/doubledot.js @@ -0,0 +1,11 @@ +var table = require('../'); +var t = table([ + [ '0.1.2' ], + [ '11.22.33' ], + [ '5.6.7' ], + [ '1.22222' ], + [ '12345.' ], + [ '5555.' ], + [ '123' ] +], { align: [ '.' ] }); +console.log(t); diff --git a/node_modules/text-table/example/table.js b/node_modules/text-table/example/table.js new file mode 100644 index 00000000..903ea4c4 --- /dev/null +++ b/node_modules/text-table/example/table.js @@ -0,0 +1,6 @@ +var table = require('../'); +var t = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] +]); +console.log(t); diff --git a/node_modules/text-table/index.js b/node_modules/text-table/index.js new file mode 100644 index 00000000..5c0ba987 --- /dev/null +++ b/node_modules/text-table/index.js @@ -0,0 +1,86 @@ +module.exports = function (rows_, opts) { + if (!opts) opts = {}; + var hsep = opts.hsep === undefined ? ' ' : opts.hsep; + var align = opts.align || []; + var stringLength = opts.stringLength + || function (s) { return String(s).length; } + ; + + var dotsizes = reduce(rows_, function (acc, row) { + forEach(row, function (c, ix) { + var n = dotindex(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + var rows = map(rows_, function (row) { + return map(row, function (c_, ix) { + var c = String(c_); + if (align[ix] === '.') { + var index = dotindex(c); + var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2) + - (stringLength(c) - index) + ; + return c + Array(size).join(' '); + } + else return c; + }); + }); + + var sizes = reduce(rows, function (acc, row) { + forEach(row, function (c, ix) { + var n = stringLength(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + return map(rows, function (row) { + return map(row, function (c, ix) { + var n = (sizes[ix] - stringLength(c)) || 0; + var s = Array(Math.max(n + 1, 1)).join(' '); + if (align[ix] === 'r' || align[ix] === '.') { + return s + c; + } + if (align[ix] === 'c') { + return Array(Math.ceil(n / 2 + 1)).join(' ') + + c + Array(Math.floor(n / 2 + 1)).join(' ') + ; + } + + return c + s; + }).join(hsep).replace(/\s+$/, ''); + }).join('\n'); +}; + +function dotindex (c) { + var m = /\.[^.]*$/.exec(c); + return m ? m.index + 1 : c.length; +} + +function reduce (xs, f, init) { + if (xs.reduce) return xs.reduce(f, init); + var i = 0; + var acc = arguments.length >= 3 ? init : xs[i++]; + for (; i < xs.length; i++) { + f(acc, xs[i], i); + } + return acc; +} + +function forEach (xs, f) { + if (xs.forEach) return xs.forEach(f); + for (var i = 0; i < xs.length; i++) { + f.call(xs, xs[i], i); + } +} + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f.call(xs, xs[i], i)); + } + return res; +} diff --git a/node_modules/text-table/package.json b/node_modules/text-table/package.json new file mode 100644 index 00000000..2c2a9933 --- /dev/null +++ b/node_modules/text-table/package.json @@ -0,0 +1,73 @@ +{ + "_from": "text-table@^0.2.0", + "_id": "text-table@0.2.0", + "_inBundle": false, + "_integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "_location": "/text-table", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "text-table@^0.2.0", + "name": "text-table", + "escapedName": "text-table", + "rawSpec": "^0.2.0", + "saveSpec": null, + "fetchSpec": "^0.2.0" + }, + "_requiredBy": [ + "/unified-args" + ], + "_resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "_shasum": "7f5ee823ae805207c00af2df4a84ec3fcfa570b4", + "_spec": "text-table@^0.2.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-args", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/text-table/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "borderless text tables with alignment", + "devDependencies": { + "cli-color": "~0.2.3", + "tap": "~0.4.0", + "tape": "~1.0.2" + }, + "homepage": "https://github.com/substack/text-table", + "keywords": [ + "text", + "table", + "align", + "ascii", + "rows", + "tabular" + ], + "license": "MIT", + "main": "index.js", + "name": "text-table", + "repository": { + "type": "git", + "url": "git://github.com/substack/text-table.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "chrome/20..latest", + "firefox/10..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6", + "ipad/6" + ] + }, + "version": "0.2.0" +} diff --git a/node_modules/text-table/readme.markdown b/node_modules/text-table/readme.markdown new file mode 100644 index 00000000..18806acd --- /dev/null +++ b/node_modules/text-table/readme.markdown @@ -0,0 +1,134 @@ +# text-table + +generate borderless text table strings suitable for printing to stdout + +[![build status](https://secure.travis-ci.org/substack/text-table.png)](http://travis-ci.org/substack/text-table) + +[![browser support](https://ci.testling.com/substack/text-table.png)](http://ci.testling.com/substack/text-table) + +# example + +## default align + +``` js +var table = require('text-table'); +var t = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] +]); +console.log(t); +``` + +``` +master 0123456789abcdef +staging fedcba9876543210 +``` + +## left-right align + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] +], { align: [ 'l', 'r' ] }); +console.log(t); +``` + +``` +beep 1024 +boop 33450 +foo 1006 +bar 45 +``` + +## dotted align + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] +], { align: [ 'l', '.' ] }); +console.log(t); +``` + +``` +beep 1024 +boop 334.212 +foo 1006 +bar 45.6 +baz 123. +``` + +## centered + +``` js +var table = require('text-table'); +var t = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] +], { align: [ 'l', 'c', 'l' ] }); +console.log(t); +``` + +``` +beep 1024 xyz +boop 3388450 tuv +foo 10106 qrstuv +bar 45 lmno +``` + +# methods + +``` js +var table = require('text-table') +``` + +## var s = table(rows, opts={}) + +Return a formatted table string `s` from an array of `rows` and some options +`opts`. + +`rows` should be an array of arrays containing strings, numbers, or other +printable values. + +options can be: + +* `opts.hsep` - separator to use between columns, default `' '` +* `opts.align` - array of alignment types for each column, default `['l','l',...]` +* `opts.stringLength` - callback function to use when calculating the string length + +alignment types are: + +* `'l'` - left +* `'r'` - right +* `'c'` - center +* `'.'` - decimal + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install text-table +``` + +# Use with ANSI-colors + +Since the string length of ANSI color schemes does not equal the length +JavaScript sees internally it is necessary to pass the a custom string length +calculator during the main function call. + +See the `test/ansi-colors.js` file for an example. + +# license + +MIT diff --git a/node_modules/text-table/test/align.js b/node_modules/text-table/test/align.js new file mode 100644 index 00000000..245357f2 --- /dev/null +++ b/node_modules/text-table/test/align.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var table = require('../'); + +test('align', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] + ], { align: [ 'l', 'r' ] }); + t.equal(s, [ + 'beep 1024', + 'boop 33450', + 'foo 1006', + 'bar 45' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/ansi-colors.js b/node_modules/text-table/test/ansi-colors.js new file mode 100644 index 00000000..fbc5bb10 --- /dev/null +++ b/node_modules/text-table/test/ansi-colors.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var table = require('../'); +var color = require('cli-color'); +var ansiTrim = require('cli-color/lib/trim'); + +test('center', function (t) { + t.plan(1); + var opts = { + align: [ 'l', 'c', 'l' ], + stringLength: function(s) { return ansiTrim(s).length } + }; + var s = table([ + [ + color.red('Red'), color.green('Green'), color.blue('Blue') + ], + [ + color.bold('Bold'), color.underline('Underline'), + color.italic('Italic') + ], + [ + color.inverse('Inverse'), color.strike('Strike'), + color.blink('Blink') + ], + [ 'bar', '45', 'lmno' ] + ], opts); + t.equal(ansiTrim(s), [ + 'Red Green Blue', + 'Bold Underline Italic', + 'Inverse Strike Blink', + 'bar 45 lmno' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/center.js b/node_modules/text-table/test/center.js new file mode 100644 index 00000000..c2c7a62a --- /dev/null +++ b/node_modules/text-table/test/center.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var table = require('../'); + +test('center', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] + ], { align: [ 'l', 'c', 'l' ] }); + t.equal(s, [ + 'beep 1024 xyz', + 'boop 3388450 tuv', + 'foo 10106 qrstuv', + 'bar 45 lmno' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/dotalign.js b/node_modules/text-table/test/dotalign.js new file mode 100644 index 00000000..f804f928 --- /dev/null +++ b/node_modules/text-table/test/dotalign.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var table = require('../'); + +test('dot align', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] + ], { align: [ 'l', '.' ] }); + t.equal(s, [ + 'beep 1024', + 'boop 334.212', + 'foo 1006', + 'bar 45.6', + 'baz 123.' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/doubledot.js b/node_modules/text-table/test/doubledot.js new file mode 100644 index 00000000..659b57c9 --- /dev/null +++ b/node_modules/text-table/test/doubledot.js @@ -0,0 +1,24 @@ +var test = require('tape'); +var table = require('../'); + +test('dot align', function (t) { + t.plan(1); + var s = table([ + [ '0.1.2' ], + [ '11.22.33' ], + [ '5.6.7' ], + [ '1.22222' ], + [ '12345.' ], + [ '5555.' ], + [ '123' ] + ], { align: [ '.' ] }); + t.equal(s, [ + ' 0.1.2', + '11.22.33', + ' 5.6.7', + ' 1.22222', + '12345.', + ' 5555.', + ' 123' + ].join('\n')); +}); diff --git a/node_modules/text-table/test/table.js b/node_modules/text-table/test/table.js new file mode 100644 index 00000000..9c670146 --- /dev/null +++ b/node_modules/text-table/test/table.js @@ -0,0 +1,14 @@ +var test = require('tape'); +var table = require('../'); + +test('table', function (t) { + t.plan(1); + var s = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] + ]); + t.equal(s, [ + 'master 0123456789abcdef', + 'staging fedcba9876543210' + ].join('\n')); +}); diff --git a/node_modules/to-object-path/LICENSE b/node_modules/to-object-path/LICENSE new file mode 100644 index 00000000..1e49edf8 --- /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 00000000..7f3cfb16 --- /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 00000000..489f8f68 --- /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 00000000..01a34e61 --- /dev/null +++ b/node_modules/to-object-path/package.json @@ -0,0 +1,79 @@ +{ + "_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" + ], + "_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": "/home/remi/github/CPP_BIDS/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 00000000..83b56e70 --- /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 00000000..2763c5ae --- /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 00000000..7bb5a743 --- /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/node_modules/is-number/LICENSE b/node_modules/to-regex-range/node_modules/is-number/LICENSE new file mode 100644 index 00000000..842218cf --- /dev/null +++ b/node_modules/to-regex-range/node_modules/is-number/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/to-regex-range/node_modules/is-number/README.md b/node_modules/to-regex-range/node_modules/is-number/README.md new file mode 100644 index 00000000..281165dc --- /dev/null +++ b/node_modules/to-regex-range/node_modules/is-number/README.md @@ -0,0 +1,115 @@ +# is-number [![NPM version](https://img.shields.io/npm/v/is-number.svg?style=flat)](https://www.npmjs.com/package/is-number) [![NPM downloads](https://img.shields.io/npm/dm/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-number.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-number) + +> Returns true if the value is a number. comprehensive tests. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-number +``` + +## Usage + +To understand some of the rationale behind the decisions made in this library (and to learn about some oddities of number evaluation in JavaScript), [see this gist](https://gist.github.com/jonschlinkert/e30c70c713da325d0e81). + +```js +var isNumber = require('is-number'); +``` + +### true + +See the [tests](./test.js) for more examples. + +```js +isNumber(5e3) //=> 'true' +isNumber(0xff) //=> 'true' +isNumber(-1.1) //=> 'true' +isNumber(0) //=> 'true' +isNumber(1) //=> 'true' +isNumber(1.1) //=> 'true' +isNumber(10) //=> 'true' +isNumber(10.10) //=> 'true' +isNumber(100) //=> 'true' +isNumber('-1.1') //=> 'true' +isNumber('0') //=> 'true' +isNumber('012') //=> 'true' +isNumber('0xff') //=> 'true' +isNumber('1') //=> 'true' +isNumber('1.1') //=> 'true' +isNumber('10') //=> 'true' +isNumber('10.10') //=> 'true' +isNumber('100') //=> 'true' +isNumber('5e3') //=> 'true' +isNumber(parseInt('012')) //=> 'true' +isNumber(parseFloat('012')) //=> 'true' +``` + +### False + +See the [tests](./test.js) for more examples. + +```js +isNumber('foo') //=> 'false' +isNumber([1]) //=> 'false' +isNumber([]) //=> 'false' +isNumber(function () {}) //=> 'false' +isNumber(Infinity) //=> 'false' +isNumber(NaN) //=> 'false' +isNumber(new Array('abc')) //=> 'false' +isNumber(new Array(2)) //=> 'false' +isNumber(new Buffer('abc')) //=> 'false' +isNumber(null) //=> 'false' +isNumber(undefined) //=> 'false' +isNumber({abc: 'abc'}) //=> 'false' +``` + +## About + +### Related projects + +* [even](https://www.npmjs.com/package/even): Get the even numbered items from an array. | [homepage](https://github.com/jonschlinkert/even "Get the even numbered items from an array.") +* [is-even](https://www.npmjs.com/package/is-even): Return true if the given number is even. | [homepage](https://github.com/jonschlinkert/is-even "Return true if the given number is even.") +* [is-odd](https://www.npmjs.com/package/is-odd): Returns true if the given number is odd. | [homepage](https://github.com/jonschlinkert/is-odd "Returns true if the given number is odd.") +* [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. ") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") +* [odd](https://www.npmjs.com/package/odd): Get the odd numbered items from an array. | [homepage](https://github.com/jonschlinkert/odd "Get the odd numbered items from an array.") + +### 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/is-number/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.30, on September 10, 2016._ \ No newline at end of file diff --git a/node_modules/to-regex-range/node_modules/is-number/index.js b/node_modules/to-regex-range/node_modules/is-number/index.js new file mode 100644 index 00000000..7a2a45be --- /dev/null +++ b/node_modules/to-regex-range/node_modules/is-number/index.js @@ -0,0 +1,22 @@ +/*! + * is-number + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var typeOf = require('kind-of'); + +module.exports = function isNumber(num) { + var type = typeOf(num); + + if (type === 'string') { + if (!num.trim()) return false; + } else if (type !== 'number') { + return false; + } + + return (num - num + 1) >= 0; +}; diff --git a/node_modules/to-regex-range/node_modules/is-number/package.json b/node_modules/to-regex-range/node_modules/is-number/package.json new file mode 100644 index 00000000..374b2a06 --- /dev/null +++ b/node_modules/to-regex-range/node_modules/is-number/package.json @@ -0,0 +1,121 @@ +{ + "_from": "is-number@^3.0.0", + "_id": "is-number@3.0.0", + "_inBundle": false, + "_integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "_location": "/to-regex-range/is-number", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-number@^3.0.0", + "name": "is-number", + "escapedName": "is-number", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/to-regex-range" + ], + "_resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "_shasum": "24fd6201a4782cf50561c810276afc7d12d71195", + "_spec": "is-number@^3.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/to-regex-range", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-number/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Charlike Mike Reagent", + "url": "http://www.tunnckocore.tk" + }, + { + "name": "Jon Schlinkert", + "email": "jon.schlinkert@sellside.com", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "kind-of": "^3.0.2" + }, + "deprecated": false, + "description": "Returns true if the value is a number. comprehensive tests.", + "devDependencies": { + "benchmarked": "^0.2.5", + "chalk": "^1.1.3", + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-number", + "keywords": [ + "check", + "coerce", + "coercion", + "integer", + "is", + "is-nan", + "is-num", + "is-number", + "istype", + "kind", + "math", + "nan", + "num", + "number", + "numeric", + "test", + "type", + "typeof", + "value" + ], + "license": "MIT", + "main": "index.js", + "name": "is-number", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-number.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "related": { + "list": [ + "even", + "is-even", + "is-odd", + "is-primitive", + "kind-of", + "odd" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ] + }, + "version": "3.0.0" +} diff --git a/node_modules/to-regex-range/package.json b/node_modules/to-regex-range/package.json new file mode 100644 index 00000000..fee26e5c --- /dev/null +++ b/node_modules/to-regex-range/package.json @@ -0,0 +1,119 @@ +{ + "_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": { + "kind-of": "3.2.2" + }, + "_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": [ + "/readdirp/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": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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 00000000..7c9987bc --- /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 00000000..5a28fc33 --- /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 00000000..a87d0159 --- /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 00000000..c67279d9 --- /dev/null +++ b/node_modules/to-regex/package.json @@ -0,0 +1,97 @@ +{ + "_from": "to-regex@^3.0.2", + "_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.2", + "name": "to-regex", + "escapedName": "to-regex", + "rawSpec": "^3.0.2", + "saveSpec": null, + "fetchSpec": "^3.0.2" + }, + "_requiredBy": [ + "/nanomatch", + "/readdirp/braces", + "/readdirp/expand-brackets", + "/readdirp/extglob", + "/readdirp/micromatch" + ], + "_resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "_shasum": "13cfdd9b336552f30b51f33a8ae1b42a7a7599ce", + "_spec": "to-regex@^3.0.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/readdirp/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/to-vfile/LICENSE b/node_modules/to-vfile/LICENSE new file mode 100644 index 00000000..32e7a3d9 --- /dev/null +++ b/node_modules/to-vfile/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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-vfile/index.js b/node_modules/to-vfile/index.js new file mode 100644 index 00000000..8c4f9151 --- /dev/null +++ b/node_modules/to-vfile/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = require('./lib/fs'); diff --git a/node_modules/to-vfile/lib/core.js b/node_modules/to-vfile/lib/core.js new file mode 100644 index 00000000..52bf04e2 --- /dev/null +++ b/node_modules/to-vfile/lib/core.js @@ -0,0 +1,18 @@ +'use strict'; + +var buffer = require('is-buffer'); +var vfile = require('vfile'); + +module.exports = toVFile; + +/* Create a virtual file from a description. + * If `options` is a string or a buffer, it’s used as the + * path. In all other cases, the options are passed through + * to `vfile()`. */ +function toVFile(options) { + if (typeof options === 'string' || buffer(options)) { + options = {path: String(options)}; + } + + return vfile(options); +} diff --git a/node_modules/to-vfile/lib/fs.js b/node_modules/to-vfile/lib/fs.js new file mode 100644 index 00000000..02a7e20b --- /dev/null +++ b/node_modules/to-vfile/lib/fs.js @@ -0,0 +1,90 @@ +'use strict'; + +var fs = require('fs'); +var func = require('x-is-function'); +var vfile = require('./core'); + +module.exports = vfile; + +vfile.read = read; +vfile.readSync = readSync; +vfile.write = write; +vfile.writeSync = writeSync; + +/* Create a virtual file and read it in, asynchronously. */ +function read(description, options, callback) { + var file = vfile(description); + + if (!callback && func(options)) { + callback = options; + options = null; + } + + if (!callback) { + return new Promise(executor); + } + + executor(null, callback); + + function executor(resolve, reject) { + fs.readFile(file.path, options, done); + + function done(err, res) { + if (err) { + reject(err); + } else { + file.contents = res; + + if (resolve) { + resolve(file); + } else { + callback(null, file); + } + } + } + } +} + +/* Create a virtual file and read it in, synchronously. */ +function readSync(description, options) { + var file = vfile(description); + file.contents = fs.readFileSync(file.path, options); + return file; +} + +/* Create a virtual file and write it out, asynchronously. */ +function write(description, options, callback) { + var file = vfile(description); + + /* Weird, right? Otherwise `fs` doesn’t accept it. */ + if (!callback && func(options)) { + callback = options; + options = undefined; + } + + if (!callback) { + return new Promise(executor); + } + + executor(null, callback); + + function executor(resolve, reject) { + fs.writeFile(file.path, file.contents || '', options, done); + + function done(err) { + if (err) { + reject(err); + } else if (resolve) { + resolve(); + } else { + callback(); + } + } + } +} + +/* Create a virtual file and write it out, synchronously. */ +function writeSync(description, options) { + var file = vfile(description); + fs.writeFileSync(file.path, file.contents || '', options); +} diff --git a/node_modules/to-vfile/package.json b/node_modules/to-vfile/package.json new file mode 100644 index 00000000..ab579829 --- /dev/null +++ b/node_modules/to-vfile/package.json @@ -0,0 +1,111 @@ +{ + "_from": "to-vfile@^2.0.0", + "_id": "to-vfile@2.2.0", + "_inBundle": false, + "_integrity": "sha512-saGC8/lWdGrEoBMLUtgzhRHWAkQMP8gdldA3MOAUhBwTGEb1RSMVcflHGSx4ZJsdEZ9o1qDBCPp47LCPrbZWow==", + "_location": "/to-vfile", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "to-vfile@^2.0.0", + "name": "to-vfile", + "escapedName": "to-vfile", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/unified-engine" + ], + "_resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-2.2.0.tgz", + "_shasum": "342d1705e6df526d569b1fc8bfa29f1f36d6c416", + "_spec": "to-vfile@^2.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-engine", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "browser": "lib/core.js", + "bugs": { + "url": "https://github.com/vfile/to-vfile/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "is-buffer": "^1.1.4", + "vfile": "^2.0.0", + "x-is-function": "^1.0.4" + }, + "deprecated": false, + "description": "Create a vfile from a file-path", + "devDependencies": { + "browserify": "^14.0.0", + "esmangle": "^1.0.1", + "nyc": "^11.0.0", + "remark-cli": "^4.0.0", + "remark-preset-wooorm": "^3.0.0", + "tape": "^4.0.0", + "xo": "^0.18.0" + }, + "files": [ + "lib", + "index.js" + ], + "homepage": "https://github.com/vfile/to-vfile#readme", + "keywords": [ + "virtual", + "file", + "text", + "processing", + "file-path", + "file", + "path" + ], + "license": "MIT", + "main": "index.js", + "name": "to-vfile", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vfile/to-vfile.git" + }, + "scripts": { + "build": "npm run build-md && npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s toVFile > to-vfile.js", + "build-mangle": "esmangle to-vfile.js > to-vfile.min.js", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "2.2.0", + "xo": { + "space": true, + "esnext": false, + "rules": { + "unicorn/no-new-buffer": "off" + }, + "ignores": [ + "to-vfile.js" + ] + } +} diff --git a/node_modules/to-vfile/readme.md b/node_modules/to-vfile/readme.md new file mode 100644 index 00000000..9f31ba4c --- /dev/null +++ b/node_modules/to-vfile/readme.md @@ -0,0 +1,116 @@ +# to-vfile [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +Create a [`vfile`][vfile] from a file-path. Optionally populates them from +the file-system as well. Can write virtual files to file-system too. + +## Installation + +[npm][]: + +```bash +npm install to-vfile +``` + +> **Note**: the file-system stuff is not available in the browser. + +## Usage + +```js +var vfile = require('to-vfile'); + +console.log(vfile('readme.md')); +console.log(vfile.readSync('.git/HEAD')); +console.log(vfile.readSync('.git/HEAD', 'utf8')); +``` + +Yields: + +```js +VFile { + data: {}, + messages: [], + history: [ 'readme.md' ], + cwd: '/Users/tilde/projects/oss/to-vfile' } +VFile { + data: {}, + messages: [], + history: [ '.git/HEAD' ], + cwd: '/Users/tilde/projects/oss/to-vfile', + contents: } +VFile { + data: {}, + messages: [], + history: [ '.git/HEAD' ], + cwd: '/Users/tilde/projects/oss/to-vfile', + contents: 'ref: refs/heads/master\n' } +``` + +## API + +### `toVFile(options)` + +Create a virtual file. Works like the [vfile][] constructor, +except when `options` is `string` or `Buffer`, in which case +it’s treated as `{path: options}` instead of `{contents: options}`. + +### `toVFile.read(options[, encoding][, callback])` + +Creates a virtual file from options (`toVFile(options)`), reads the +file from the file-system and populates `file.contents` with the result. +If `encoding` is specified, it’s passed to `fs.readFile`. +If `callback` is given, invokes it with either an error or the populated +virtual file. +If `callback` is not given, returns a [`Promise`][promise] that is +rejected with an error or resolved with the populated virtual file. + +### `toVFile.readSync(options[, encoding])` + +Like `toVFile.read` but synchronous. Either throws an error or +returns a populated virtual file. + +### `toVFile.write(options[, fsOptions][, callback])` + +Creates a virtual file from `options` (`toVFile(options)`), writes the +file to the file-system. `fsOptions` are passed to `fs.writeFile`. +If `callback` is given, invokes it with an error, if any. +If `callback` is not given, returns a [`Promise`][promise] that is +rejected with an error or resolved without any value. + +### `toVFile.writeSync(options[, fsOptions])` + +Like `toVFile.write` but synchronous. Throws an error, if any. + +## Contribute + +See [`contribute.md` in `vfile/vfile`][contribute] for ways to get started. + +This organisation has a [Code of Conduct][coc]. By interacting with this +repository, organisation, or community you agree to abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/vfile/to-vfile.svg + +[travis]: https://travis-ci.org/vfile/to-vfile + +[codecov-badge]: https://img.shields.io/codecov/c/github/vfile/to-vfile.svg + +[codecov]: https://codecov.io/github/vfile/to-vfile + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[vfile]: https://github.com/vfile/vfile + +[promise]: https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/Promise + +[contribute]: https://github.com/vfile/vfile/blob/master/contributing.md + +[coc]: https://github.com/vfile/vfile/blob/master/code-of-conduct.md diff --git a/node_modules/trim-trailing-lines/index.js b/node_modules/trim-trailing-lines/index.js new file mode 100644 index 00000000..0f2d48b5 --- /dev/null +++ b/node_modules/trim-trailing-lines/index.js @@ -0,0 +1,17 @@ +'use strict' + +module.exports = trimTrailingLines + +var line = '\n' + +// Remove final newline characters from `value`. +function trimTrailingLines(value) { + var val = String(value) + var index = val.length + + while (val.charAt(--index) === line) { + // Empty + } + + return val.slice(0, index + 1) +} diff --git a/node_modules/trim-trailing-lines/license b/node_modules/trim-trailing-lines/license new file mode 100644 index 00000000..611b6758 --- /dev/null +++ b/node_modules/trim-trailing-lines/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/trim-trailing-lines/package.json b/node_modules/trim-trailing-lines/package.json new file mode 100644 index 00000000..ed28caa4 --- /dev/null +++ b/node_modules/trim-trailing-lines/package.json @@ -0,0 +1,111 @@ +{ + "_from": "trim-trailing-lines@^1.0.0", + "_id": "trim-trailing-lines@1.1.3", + "_inBundle": false, + "_integrity": "sha512-4ku0mmjXifQcTVfYDfR5lpgV7zVqPg6zV9rdZmwOPqq0+Zq19xDqEgagqVbc4pOOShbncuAOIs59R3+3gcF3ZA==", + "_location": "/trim-trailing-lines", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "trim-trailing-lines@^1.0.0", + "name": "trim-trailing-lines", + "escapedName": "trim-trailing-lines", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-parse" + ], + "_resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.3.tgz", + "_shasum": "7f0739881ff76657b7776e10874128004b625a94", + "_spec": "trim-trailing-lines@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/trim-trailing-lines/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Remove final line feeds from a string", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.25.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "homepage": "https://github.com/wooorm/trim-trailing-lines#readme", + "keywords": [ + "trim", + "final", + "line", + "newline", + "characters" + ], + "license": "MIT", + "name": "trim-trailing-lines", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/trim-trailing-lines.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s trimTrailingLines -o trim-trailing-lines.js", + "build-mangle": "browserify . -s trimTrailingLines -p tinyify -o trim-trailing-lines.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.3", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "trim-trailing-lines.js" + ] + } +} diff --git a/node_modules/trim-trailing-lines/readme.md b/node_modules/trim-trailing-lines/readme.md new file mode 100644 index 00000000..a9c1f441 --- /dev/null +++ b/node_modules/trim-trailing-lines/readme.md @@ -0,0 +1,68 @@ +# trim-trailing-lines + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Remove final line feeds from a string. + +## Install + +[npm][]: + +```sh +npm install trim-trailing-lines +``` + +## Use + +```js +var trimTrailingLines = require('trim-trailing-lines') + +trimTrailingLines('foo\nbar') // => 'foo\nbar' +trimTrailingLines('foo\nbar\n') // => 'foo\nbar' +trimTrailingLines('foo\nbar\n\n') // => 'foo\nbar' +``` + +## API + +### `trimTrailingLines(value)` + +Remove final line feed characters from `value`. + +###### Parameters + +* `value` (`string`) — Value with trailing line feeds, coerced to string. + +###### Returns + +`string` — Value without trailing newlines. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/trim-trailing-lines.svg + +[build]: https://travis-ci.org/wooorm/trim-trailing-lines + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/trim-trailing-lines.svg + +[coverage]: https://codecov.io/github/wooorm/trim-trailing-lines + +[downloads-badge]: https://img.shields.io/npm/dm/trim-trailing-lines.svg + +[downloads]: https://www.npmjs.com/package/trim-trailing-lines + +[size-badge]: https://img.shields.io/bundlephobia/minzip/trim-trailing-lines.svg + +[size]: https://bundlephobia.com/result?p=trim-trailing-lines + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com diff --git a/node_modules/trim/.npmignore b/node_modules/trim/.npmignore new file mode 100644 index 00000000..f1250e58 --- /dev/null +++ b/node_modules/trim/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/trim/History.md b/node_modules/trim/History.md new file mode 100644 index 00000000..c8aa68fa --- /dev/null +++ b/node_modules/trim/History.md @@ -0,0 +1,5 @@ + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/trim/Makefile b/node_modules/trim/Makefile new file mode 100644 index 00000000..4e9c8d36 --- /dev/null +++ b/node_modules/trim/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/node_modules/trim/Readme.md b/node_modules/trim/Readme.md new file mode 100644 index 00000000..3460f523 --- /dev/null +++ b/node_modules/trim/Readme.md @@ -0,0 +1,69 @@ + +# trim + + Trims string whitespace. + +## Installation + +``` +$ npm install trim +$ component install component/trim +``` + +## API + + - [trim(str)](#trimstr) + - [.left(str)](#leftstr) + - [.right(str)](#rightstr) +
+ + +### trim(str) +should trim leading / trailing whitespace. + +```js +trim(' foo bar ').should.equal('foo bar'); +trim('\n\n\nfoo bar\n\r\n\n').should.equal('foo bar'); +``` + + +### .left(str) +should trim leading whitespace. + +```js +trim.left(' foo bar ').should.equal('foo bar '); +``` + + +### .right(str) +should trim trailing whitespace. + +```js +trim.right(' foo bar ').should.equal(' foo bar'); +``` + + +## License + +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> + +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/trim/component.json b/node_modules/trim/component.json new file mode 100644 index 00000000..560b2589 --- /dev/null +++ b/node_modules/trim/component.json @@ -0,0 +1,7 @@ +{ + "name": "trim", + "version": "0.0.1", + "description": "Trim string whitespace", + "keywords": ["string", "trim"], + "scripts": ["index.js"] +} \ No newline at end of file diff --git a/node_modules/trim/index.js b/node_modules/trim/index.js new file mode 100644 index 00000000..640c24cf --- /dev/null +++ b/node_modules/trim/index.js @@ -0,0 +1,14 @@ + +exports = module.exports = trim; + +function trim(str){ + return str.replace(/^\s*|\s*$/g, ''); +} + +exports.left = function(str){ + return str.replace(/^\s*/, ''); +}; + +exports.right = function(str){ + return str.replace(/\s*$/, ''); +}; diff --git a/node_modules/trim/package.json b/node_modules/trim/package.json new file mode 100644 index 00000000..ff0a9e76 --- /dev/null +++ b/node_modules/trim/package.json @@ -0,0 +1,50 @@ +{ + "_from": "trim@0.0.1", + "_id": "trim@0.0.1", + "_inBundle": false, + "_integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", + "_location": "/trim", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "trim@0.0.1", + "name": "trim", + "escapedName": "trim", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/remark-parse", + "/unified-message-control" + ], + "_resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "_shasum": "5858547f6b290757ee95cccc666fb50084c460dd", + "_spec": "trim@0.0.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-parse", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "trim/index.js": "index.js" + } + }, + "dependencies": {}, + "deprecated": false, + "description": "Trim string whitespace", + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "keywords": [ + "string", + "trim" + ], + "main": "index", + "name": "trim", + "version": "0.0.1" +} diff --git a/node_modules/trough/index.js b/node_modules/trough/index.js new file mode 100644 index 00000000..2b73d868 --- /dev/null +++ b/node_modules/trough/index.js @@ -0,0 +1,74 @@ +'use strict' + +var wrap = require('./wrap.js') + +module.exports = trough + +trough.wrap = wrap + +var slice = [].slice + +// Create new middleware. +function trough() { + var fns = [] + var middleware = {} + + middleware.run = run + middleware.use = use + + return middleware + + // Run `fns`. Last argument must be a completion handler. + function run() { + var index = -1 + var input = slice.call(arguments, 0, -1) + var done = arguments[arguments.length - 1] + + if (typeof done !== 'function') { + throw new Error('Expected function as last argument, not ' + done) + } + + next.apply(null, [null].concat(input)) + + // Run the next `fn`, if any. + function next(err) { + var fn = fns[++index] + var params = slice.call(arguments, 0) + var values = params.slice(1) + var length = input.length + var pos = -1 + + if (err) { + done(err) + return + } + + // Copy non-nully input into values. + while (++pos < length) { + if (values[pos] === null || values[pos] === undefined) { + values[pos] = input[pos] + } + } + + input = values + + // Next or done. + if (fn) { + wrap(fn, next).apply(null, input) + } else { + done.apply(null, [null].concat(input)) + } + } + } + + // Add `fn` to the list. + function use(fn) { + if (typeof fn !== 'function') { + throw new Error('Expected `fn` to be a function, not ' + fn) + } + + fns.push(fn) + + return middleware + } +} diff --git a/node_modules/trough/license b/node_modules/trough/license new file mode 100644 index 00000000..3f0166f6 --- /dev/null +++ b/node_modules/trough/license @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/trough/package.json b/node_modules/trough/package.json new file mode 100644 index 00000000..d0f5a398 --- /dev/null +++ b/node_modules/trough/package.json @@ -0,0 +1,115 @@ +{ + "_from": "trough@^1.0.0", + "_id": "trough@1.0.5", + "_inBundle": false, + "_integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "_location": "/trough", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "trough@^1.0.0", + "name": "trough", + "escapedName": "trough", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/unified", + "/unified-engine" + ], + "_resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", + "_shasum": "b8b639cefad7d0bb2abd37d433ff8293efa5f406", + "_spec": "trough@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/trough/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": {}, + "deprecated": false, + "description": "Middleware: a channel used to convey a liquid", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.25.0" + }, + "files": [ + "index.js", + "wrap.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "homepage": "https://github.com/wooorm/trough#readme", + "keywords": [ + "middleware", + "ware" + ], + "license": "MIT", + "name": "trough", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/trough.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s trough > trough.js", + "build-mangle": "browserify index.js -s trough -p tinyify > trough.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.5", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-reflect-apply": "off", + "unicorn/prefer-type-error": "off", + "guard-for-in": "off" + }, + "ignores": [ + "trough.js" + ] + } +} diff --git a/node_modules/trough/readme.md b/node_modules/trough/readme.md new file mode 100644 index 00000000..ce3d38bc --- /dev/null +++ b/node_modules/trough/readme.md @@ -0,0 +1,330 @@ +# trough + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +> **trough** /trôf/ — a channel used to convey a liquid. + +`trough` is like [`ware`][ware] with less sugar, and middleware functions can +change the input of the next. + +## Install + +[npm][]: + +```sh +npm install trough +``` + +## Use + +```js +var fs = require('fs') +var path = require('path') +var trough = require('trough') + +var pipeline = trough() + .use(function(fileName) { + console.log('Checking… ' + fileName) + }) + .use(function(fileName) { + return path.join(process.cwd(), fileName) + }) + .use(function(filePath, next) { + fs.stat(filePath, function(err, stats) { + next(err, {filePath, stats}) + }) + }) + .use(function(ctx, next) { + if (ctx.stats.isFile()) { + fs.readFile(ctx.filePath, next) + } else { + next(new Error('Expected file')) + } + }) + +pipeline.run('readme.md', console.log) +pipeline.run('node_modules', console.log) +``` + +Yields: + +```txt +Checking… readme.md +Checking… node_modules +Error: Expected file + at ~/example.js:21:12 + at wrapped (~/node_modules/trough/index.js:93:19) + at next (~/node_modules/trough/index.js:56:24) + at done (~/node_modules/trough/index.js:124:12) + at ~/node_modules/example.js:14:7 + at FSReqWrap.oncomplete (fs.js:153:5) +null +``` + +## API + +### `trough()` + +Create a new [`Trough`][trough]. + +#### `trough.wrap(middleware, callback[, …input])` + +Call `middleware` with all input. +If `middleware` accepts more arguments than given in input, and extra `done` +function is passed in after the input when calling it. +It must be called. + +The first value in `input` is called the main input value. +All other input values are called the rest input values. +The values given to `callback` are the input values, merged with every non-nully +output value. + +* If `middleware` throws an error, returns a promise that is rejected, or + calls the given `done` function with an error, `callback` is invoked with + that error +* If `middleware` returns a value or returns a promise that is resolved, that + value is the main output value +* If `middleware` calls `done`, all non-nully values except for the first one + (the error) overwrite the output values + +### `Trough` + +A pipeline. + +#### `Trough#run([input…, ]done)` + +Run the pipeline (all [`use()`][use]d middleware). +Invokes [`done`][done] on completion with either an error or the output of the +last middleware. + +> Note! +> as the length of input defines whether [async][] functions get a `next` +> function, it’s recommended to keep `input` at one value normally. + +##### `function done(err?, [output…])` + +The final handler passed to [`run()`][run], invoked with an error if a +[middleware function][fn] rejected, passed, or threw one, or the output of the +last middleware function. + +#### `Trough#use(fn)` + +Add `fn`, a [middleware function][fn], to the pipeline. + +##### `function fn([input…, ][next])` + +A middleware function invoked with the output of its predecessor. + +###### Synchronous + +If `fn` returns or throws an error, the pipeline fails and `done` is invoked +with that error. + +If `fn` returns a value (neither `null` nor `undefined`), the first `input` of +the next function is set to that value (all other `input` is passed through). + +The following example shows how returning an error stops the pipeline: + +```js +var trough = require('trough') + +trough() + .use(function(val) { + return new Error('Got: ' + val) + }) + .run('some value', console.log) +``` + +Yields: + +```txt +Error: Got: some value + at ~/example.js:5:12 + … +``` + +The following example shows how throwing an error stops the pipeline: + +```js +var trough = require('trough') + +trough() + .use(function(val) { + throw new Error('Got: ' + val) + }) + .run('more value', console.log) +``` + +Yields: + +```txt +Error: Got: more value + at ~/example.js:5:11 + … +``` + +The following example shows how the first output can be modified: + +```js +var trough = require('trough') + +trough() + .use(function(val) { + return 'even ' + val + }) + .run('more value', 'untouched', console.log) +``` + +Yields: + +```txt +null 'even more value' 'untouched' +``` + +###### Promise + +If `fn` returns a promise, and that promise rejects, the pipeline fails and +`done` is invoked with the rejected value. + +If `fn` returns a promise, and that promise resolves with a value (neither +`null` nor `undefined`), the first `input` of the next function is set to that +value (all other `input` is passed through). + +The following example shows how rejecting a promise stops the pipeline: + +```js +var trough = require('trough') + +trough() + .use(function(val) { + return new Promise(function(resolve, reject) { + reject('Got: ' + val) + }) + }) + .run('val', console.log) +``` + +Yields: + +```txt +Got: val +``` + +The following example shows how the input isn’t touched by resolving to `null`. + +```js +var trough = require('trough') + +trough() + .use(function() { + return new Promise(function(resolve) { + setTimeout(function() { + resolve(null) + }, 100) + }) + }) + .run('Input', console.log) +``` + +Yields: + +```txt +null 'Input' +``` + +###### Asynchronous + +If `fn` accepts one more argument than the given `input`, a `next` function is +given (after the input). `next` must be called, but doesn’t have to be called +async. + +If `next` is given a value (neither `null` nor `undefined`) as its first +argument, the pipeline fails and `done` is invoked with that value. + +If `next` is given no value (either `null` or `undefined`) as the first +argument, all following non-nully values change the input of the following +function, and all nully values default to the `input`. + +The following example shows how passing a first argument stops the pipeline: + +```js +var trough = require('trough') + +trough() + .use(function(val, next) { + next(new Error('Got: ' + val)) + }) + .run('val', console.log) +``` + +Yields: + +```txt +Error: Got: val + at ~/example.js:5:10 +``` + +The following example shows how more values than the input are passed. + +```js +var trough = require('trough') + +trough() + .use(function(val, next) { + setTimeout(function() { + next(null, null, 'values') + }, 100) + }) + .run('some', console.log) +``` + +Yields: + +```txt +null 'some' 'values' +``` + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/trough.svg + +[build]: https://travis-ci.org/wooorm/trough + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/trough.svg + +[coverage]: https://codecov.io/github/wooorm/trough + +[downloads-badge]: https://img.shields.io/npm/dm/trough.svg + +[downloads]: https://www.npmjs.com/package/trough + +[size-badge]: https://img.shields.io/bundlephobia/minzip/trough.svg + +[size]: https://bundlephobia.com/result?p=trough + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[ware]: https://github.com/segmentio/ware + +[trough]: #trough-1 + +[use]: #troughusefn + +[run]: #troughruninput-done + +[fn]: #function-fninput-next + +[done]: #function-doneerr-output + +[async]: #asynchronous diff --git a/node_modules/trough/wrap.js b/node_modules/trough/wrap.js new file mode 100644 index 00000000..cf568c07 --- /dev/null +++ b/node_modules/trough/wrap.js @@ -0,0 +1,64 @@ +'use strict' + +var slice = [].slice + +module.exports = wrap + +// Wrap `fn`. +// Can be sync or async; return a promise, receive a completion handler, return +// new values and errors. +function wrap(fn, callback) { + var invoked + + return wrapped + + function wrapped() { + var params = slice.call(arguments, 0) + var callback = fn.length > params.length + var result + + if (callback) { + params.push(done) + } + + try { + result = fn.apply(null, params) + } catch (error) { + // Well, this is quite the pickle. + // `fn` received a callback and invoked it (thus continuing the pipeline), + // but later also threw an error. + // We’re not about to restart the pipeline again, so the only thing left + // to do is to throw the thing instead. + if (callback && invoked) { + throw error + } + + return done(error) + } + + if (!callback) { + if (result && typeof result.then === 'function') { + result.then(then, done) + } else if (result instanceof Error) { + done(result) + } else { + then(result) + } + } + } + + // Invoke `next`, only once. + function done() { + if (!invoked) { + invoked = true + + callback.apply(null, arguments) + } + } + + // Invoke `done` with one value. + // Tracks if an error is passed, too. + function then(value) { + done(null, value) + } +} diff --git a/node_modules/typedarray/.travis.yml b/node_modules/typedarray/.travis.yml new file mode 100644 index 00000000..cc4dba29 --- /dev/null +++ b/node_modules/typedarray/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/node_modules/typedarray/LICENSE b/node_modules/typedarray/LICENSE new file mode 100644 index 00000000..11adfaec --- /dev/null +++ b/node_modules/typedarray/LICENSE @@ -0,0 +1,35 @@ +/* + Copyright (c) 2010, Linden Research, Inc. + Copyright (c) 2012, Joshua Bell + + 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. + $/LicenseInfo$ + */ + +// Original can be found at: +// https://bitbucket.org/lindenlab/llsd +// Modifications by Joshua Bell inexorabletash@gmail.com +// https://github.com/inexorabletash/polyfill + +// ES3/ES5 implementation of the Krhonos Typed Array Specification +// Ref: http://www.khronos.org/registry/typedarray/specs/latest/ +// Date: 2011-02-01 +// +// Variations: +// * Allows typed_array.get/set() as alias for subscripts (typed_array[]) diff --git a/node_modules/typedarray/example/tarray.js b/node_modules/typedarray/example/tarray.js new file mode 100644 index 00000000..8423d7c9 --- /dev/null +++ b/node_modules/typedarray/example/tarray.js @@ -0,0 +1,4 @@ +var Uint8Array = require('../').Uint8Array; +var ua = new Uint8Array(5); +ua[1] = 256 + 55; +console.log(ua[1]); diff --git a/node_modules/typedarray/index.js b/node_modules/typedarray/index.js new file mode 100644 index 00000000..5e540841 --- /dev/null +++ b/node_modules/typedarray/index.js @@ -0,0 +1,630 @@ +var undefined = (void 0); // Paranoia + +// Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to +// create, and consume so much memory, that the browser appears frozen. +var MAX_ARRAY_LENGTH = 1e5; + +// Approximations of internal ECMAScript conversion functions +var ECMAScript = (function() { + // Stash a copy in case other scripts modify these + var opts = Object.prototype.toString, + ophop = Object.prototype.hasOwnProperty; + + return { + // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues: + Class: function(v) { return opts.call(v).replace(/^\[object *|\]$/g, ''); }, + HasProperty: function(o, p) { return p in o; }, + HasOwnProperty: function(o, p) { return ophop.call(o, p); }, + IsCallable: function(o) { return typeof o === 'function'; }, + ToInt32: function(v) { return v >> 0; }, + ToUint32: function(v) { return v >>> 0; } + }; +}()); + +// Snapshot intrinsics +var LN2 = Math.LN2, + abs = Math.abs, + floor = Math.floor, + log = Math.log, + min = Math.min, + pow = Math.pow, + round = Math.round; + +// ES5: lock down object properties +function configureProperties(obj) { + if (getOwnPropNames && defineProp) { + var props = getOwnPropNames(obj), i; + for (i = 0; i < props.length; i += 1) { + defineProp(obj, props[i], { + value: obj[props[i]], + writable: false, + enumerable: false, + configurable: false + }); + } + } +} + +// emulate ES5 getter/setter API using legacy APIs +// http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx +// (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but +// note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless) +var defineProp +if (Object.defineProperty && (function() { + try { + Object.defineProperty({}, 'x', {}); + return true; + } catch (e) { + return false; + } + })()) { + defineProp = Object.defineProperty; +} else { + defineProp = function(o, p, desc) { + if (!o === Object(o)) throw new TypeError("Object.defineProperty called on non-object"); + if (ECMAScript.HasProperty(desc, 'get') && Object.prototype.__defineGetter__) { Object.prototype.__defineGetter__.call(o, p, desc.get); } + if (ECMAScript.HasProperty(desc, 'set') && Object.prototype.__defineSetter__) { Object.prototype.__defineSetter__.call(o, p, desc.set); } + if (ECMAScript.HasProperty(desc, 'value')) { o[p] = desc.value; } + return o; + }; +} + +var getOwnPropNames = Object.getOwnPropertyNames || function (o) { + if (o !== Object(o)) throw new TypeError("Object.getOwnPropertyNames called on non-object"); + var props = [], p; + for (p in o) { + if (ECMAScript.HasOwnProperty(o, p)) { + props.push(p); + } + } + return props; +}; + +// ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value) +// for index in 0 ... obj.length +function makeArrayAccessors(obj) { + if (!defineProp) { return; } + + if (obj.length > MAX_ARRAY_LENGTH) throw new RangeError("Array too large for polyfill"); + + function makeArrayAccessor(index) { + defineProp(obj, index, { + 'get': function() { return obj._getter(index); }, + 'set': function(v) { obj._setter(index, v); }, + enumerable: true, + configurable: false + }); + } + + var i; + for (i = 0; i < obj.length; i += 1) { + makeArrayAccessor(i); + } +} + +// Internal conversion functions: +// pack() - take a number (interpreted as Type), output a byte array +// unpack() - take a byte array, output a Type-like number + +function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; } +function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; } + +function packI8(n) { return [n & 0xff]; } +function unpackI8(bytes) { return as_signed(bytes[0], 8); } + +function packU8(n) { return [n & 0xff]; } +function unpackU8(bytes) { return as_unsigned(bytes[0], 8); } + +function packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; } + +function packI16(n) { return [(n >> 8) & 0xff, n & 0xff]; } +function unpackI16(bytes) { return as_signed(bytes[0] << 8 | bytes[1], 16); } + +function packU16(n) { return [(n >> 8) & 0xff, n & 0xff]; } +function unpackU16(bytes) { return as_unsigned(bytes[0] << 8 | bytes[1], 16); } + +function packI32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; } +function unpackI32(bytes) { return as_signed(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } + +function packU32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; } +function unpackU32(bytes) { return as_unsigned(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } + +function packIEEE754(v, ebits, fbits) { + + var bias = (1 << (ebits - 1)) - 1, + s, e, f, ln, + i, bits, str, bytes; + + function roundToEven(n) { + var w = floor(n), f = n - w; + if (f < 0.5) + return w; + if (f > 0.5) + return w + 1; + return w % 2 ? w + 1 : w; + } + + // Compute sign, exponent, fraction + if (v !== v) { + // NaN + // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping + e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0; + } else if (v === Infinity || v === -Infinity) { + e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0; + } else if (v === 0) { + e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0; + } else { + s = v < 0; + v = abs(v); + + if (v >= pow(2, 1 - bias)) { + e = min(floor(log(v) / LN2), 1023); + f = roundToEven(v / pow(2, e) * pow(2, fbits)); + if (f / pow(2, fbits) >= 2) { + e = e + 1; + f = 1; + } + if (e > bias) { + // Overflow + e = (1 << ebits) - 1; + f = 0; + } else { + // Normalized + e = e + bias; + f = f - pow(2, fbits); + } + } else { + // Denormalized + e = 0; + f = roundToEven(v / pow(2, 1 - bias - fbits)); + } + } + + // Pack sign, exponent, fraction + bits = []; + for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); } + for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); } + bits.push(s ? 1 : 0); + bits.reverse(); + str = bits.join(''); + + // Bits to bytes + bytes = []; + while (str.length) { + bytes.push(parseInt(str.substring(0, 8), 2)); + str = str.substring(8); + } + return bytes; +} + +function unpackIEEE754(bytes, ebits, fbits) { + + // Bytes to bits + var bits = [], i, j, b, str, + bias, s, e, f; + + for (i = bytes.length; i; i -= 1) { + b = bytes[i - 1]; + for (j = 8; j; j -= 1) { + bits.push(b % 2 ? 1 : 0); b = b >> 1; + } + } + bits.reverse(); + str = bits.join(''); + + // Unpack sign, exponent, fraction + bias = (1 << (ebits - 1)) - 1; + s = parseInt(str.substring(0, 1), 2) ? -1 : 1; + e = parseInt(str.substring(1, 1 + ebits), 2); + f = parseInt(str.substring(1 + ebits), 2); + + // Produce number + if (e === (1 << ebits) - 1) { + return f !== 0 ? NaN : s * Infinity; + } else if (e > 0) { + // Normalized + return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); + } else if (f !== 0) { + // Denormalized + return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); + } else { + return s < 0 ? -0 : 0; + } +} + +function unpackF64(b) { return unpackIEEE754(b, 11, 52); } +function packF64(v) { return packIEEE754(v, 11, 52); } +function unpackF32(b) { return unpackIEEE754(b, 8, 23); } +function packF32(v) { return packIEEE754(v, 8, 23); } + + +// +// 3 The ArrayBuffer Type +// + +(function() { + + /** @constructor */ + var ArrayBuffer = function ArrayBuffer(length) { + length = ECMAScript.ToInt32(length); + if (length < 0) throw new RangeError('ArrayBuffer size is not a small enough positive integer'); + + this.byteLength = length; + this._bytes = []; + this._bytes.length = length; + + var i; + for (i = 0; i < this.byteLength; i += 1) { + this._bytes[i] = 0; + } + + configureProperties(this); + }; + + exports.ArrayBuffer = exports.ArrayBuffer || ArrayBuffer; + + // + // 4 The ArrayBufferView Type + // + + // NOTE: this constructor is not exported + /** @constructor */ + var ArrayBufferView = function ArrayBufferView() { + //this.buffer = null; + //this.byteOffset = 0; + //this.byteLength = 0; + }; + + // + // 5 The Typed Array View Types + // + + function makeConstructor(bytesPerElement, pack, unpack) { + // Each TypedArray type requires a distinct constructor instance with + // identical logic, which this produces. + + var ctor; + ctor = function(buffer, byteOffset, length) { + var array, sequence, i, s; + + if (!arguments.length || typeof arguments[0] === 'number') { + // Constructor(unsigned long length) + this.length = ECMAScript.ToInt32(arguments[0]); + if (length < 0) throw new RangeError('ArrayBufferView size is not a small enough positive integer'); + + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + } else if (typeof arguments[0] === 'object' && arguments[0].constructor === ctor) { + // Constructor(TypedArray array) + array = arguments[0]; + + this.length = array.length; + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + + for (i = 0; i < this.length; i += 1) { + this._setter(i, array._getter(i)); + } + } else if (typeof arguments[0] === 'object' && + !(arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) { + // Constructor(sequence array) + sequence = arguments[0]; + + this.length = ECMAScript.ToUint32(sequence.length); + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + + for (i = 0; i < this.length; i += 1) { + s = sequence[i]; + this._setter(i, Number(s)); + } + } else if (typeof arguments[0] === 'object' && + (arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) { + // Constructor(ArrayBuffer buffer, + // optional unsigned long byteOffset, optional unsigned long length) + this.buffer = buffer; + + this.byteOffset = ECMAScript.ToUint32(byteOffset); + if (this.byteOffset > this.buffer.byteLength) { + throw new RangeError("byteOffset out of range"); + } + + if (this.byteOffset % this.BYTES_PER_ELEMENT) { + // The given byteOffset must be a multiple of the element + // size of the specific type, otherwise an exception is raised. + throw new RangeError("ArrayBuffer length minus the byteOffset is not a multiple of the element size."); + } + + if (arguments.length < 3) { + this.byteLength = this.buffer.byteLength - this.byteOffset; + + if (this.byteLength % this.BYTES_PER_ELEMENT) { + throw new RangeError("length of buffer minus byteOffset not a multiple of the element size"); + } + this.length = this.byteLength / this.BYTES_PER_ELEMENT; + } else { + this.length = ECMAScript.ToUint32(length); + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + } + + if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) { + throw new RangeError("byteOffset and length reference an area beyond the end of the buffer"); + } + } else { + throw new TypeError("Unexpected argument type(s)"); + } + + this.constructor = ctor; + + configureProperties(this); + makeArrayAccessors(this); + }; + + ctor.prototype = new ArrayBufferView(); + ctor.prototype.BYTES_PER_ELEMENT = bytesPerElement; + ctor.prototype._pack = pack; + ctor.prototype._unpack = unpack; + ctor.BYTES_PER_ELEMENT = bytesPerElement; + + // getter type (unsigned long index); + ctor.prototype._getter = function(index) { + if (arguments.length < 1) throw new SyntaxError("Not enough arguments"); + + index = ECMAScript.ToUint32(index); + if (index >= this.length) { + return undefined; + } + + var bytes = [], i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + bytes.push(this.buffer._bytes[o]); + } + return this._unpack(bytes); + }; + + // NONSTANDARD: convenience alias for getter: type get(unsigned long index); + ctor.prototype.get = ctor.prototype._getter; + + // setter void (unsigned long index, type value); + ctor.prototype._setter = function(index, value) { + if (arguments.length < 2) throw new SyntaxError("Not enough arguments"); + + index = ECMAScript.ToUint32(index); + if (index >= this.length) { + return undefined; + } + + var bytes = this._pack(value), i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + this.buffer._bytes[o] = bytes[i]; + } + }; + + // void set(TypedArray array, optional unsigned long offset); + // void set(sequence array, optional unsigned long offset); + ctor.prototype.set = function(index, value) { + if (arguments.length < 1) throw new SyntaxError("Not enough arguments"); + var array, sequence, offset, len, + i, s, d, + byteOffset, byteLength, tmp; + + if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) { + // void set(TypedArray array, optional unsigned long offset); + array = arguments[0]; + offset = ECMAScript.ToUint32(arguments[1]); + + if (offset + array.length > this.length) { + throw new RangeError("Offset plus length of array is out of range"); + } + + byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT; + byteLength = array.length * this.BYTES_PER_ELEMENT; + + if (array.buffer === this.buffer) { + tmp = []; + for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) { + tmp[i] = array.buffer._bytes[s]; + } + for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) { + this.buffer._bytes[d] = tmp[i]; + } + } else { + for (i = 0, s = array.byteOffset, d = byteOffset; + i < byteLength; i += 1, s += 1, d += 1) { + this.buffer._bytes[d] = array.buffer._bytes[s]; + } + } + } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') { + // void set(sequence array, optional unsigned long offset); + sequence = arguments[0]; + len = ECMAScript.ToUint32(sequence.length); + offset = ECMAScript.ToUint32(arguments[1]); + + if (offset + len > this.length) { + throw new RangeError("Offset plus length of array is out of range"); + } + + for (i = 0; i < len; i += 1) { + s = sequence[i]; + this._setter(offset + i, Number(s)); + } + } else { + throw new TypeError("Unexpected argument type(s)"); + } + }; + + // TypedArray subarray(long begin, optional long end); + ctor.prototype.subarray = function(start, end) { + function clamp(v, min, max) { return v < min ? min : v > max ? max : v; } + + start = ECMAScript.ToInt32(start); + end = ECMAScript.ToInt32(end); + + if (arguments.length < 1) { start = 0; } + if (arguments.length < 2) { end = this.length; } + + if (start < 0) { start = this.length + start; } + if (end < 0) { end = this.length + end; } + + start = clamp(start, 0, this.length); + end = clamp(end, 0, this.length); + + var len = end - start; + if (len < 0) { + len = 0; + } + + return new this.constructor( + this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len); + }; + + return ctor; + } + + var Int8Array = makeConstructor(1, packI8, unpackI8); + var Uint8Array = makeConstructor(1, packU8, unpackU8); + var Uint8ClampedArray = makeConstructor(1, packU8Clamped, unpackU8); + var Int16Array = makeConstructor(2, packI16, unpackI16); + var Uint16Array = makeConstructor(2, packU16, unpackU16); + var Int32Array = makeConstructor(4, packI32, unpackI32); + var Uint32Array = makeConstructor(4, packU32, unpackU32); + var Float32Array = makeConstructor(4, packF32, unpackF32); + var Float64Array = makeConstructor(8, packF64, unpackF64); + + exports.Int8Array = exports.Int8Array || Int8Array; + exports.Uint8Array = exports.Uint8Array || Uint8Array; + exports.Uint8ClampedArray = exports.Uint8ClampedArray || Uint8ClampedArray; + exports.Int16Array = exports.Int16Array || Int16Array; + exports.Uint16Array = exports.Uint16Array || Uint16Array; + exports.Int32Array = exports.Int32Array || Int32Array; + exports.Uint32Array = exports.Uint32Array || Uint32Array; + exports.Float32Array = exports.Float32Array || Float32Array; + exports.Float64Array = exports.Float64Array || Float64Array; +}()); + +// +// 6 The DataView View Type +// + +(function() { + function r(array, index) { + return ECMAScript.IsCallable(array.get) ? array.get(index) : array[index]; + } + + var IS_BIG_ENDIAN = (function() { + var u16array = new(exports.Uint16Array)([0x1234]), + u8array = new(exports.Uint8Array)(u16array.buffer); + return r(u8array, 0) === 0x12; + }()); + + // Constructor(ArrayBuffer buffer, + // optional unsigned long byteOffset, + // optional unsigned long byteLength) + /** @constructor */ + var DataView = function DataView(buffer, byteOffset, byteLength) { + if (arguments.length === 0) { + buffer = new exports.ArrayBuffer(0); + } else if (!(buffer instanceof exports.ArrayBuffer || ECMAScript.Class(buffer) === 'ArrayBuffer')) { + throw new TypeError("TypeError"); + } + + this.buffer = buffer || new exports.ArrayBuffer(0); + + this.byteOffset = ECMAScript.ToUint32(byteOffset); + if (this.byteOffset > this.buffer.byteLength) { + throw new RangeError("byteOffset out of range"); + } + + if (arguments.length < 3) { + this.byteLength = this.buffer.byteLength - this.byteOffset; + } else { + this.byteLength = ECMAScript.ToUint32(byteLength); + } + + if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) { + throw new RangeError("byteOffset and length reference an area beyond the end of the buffer"); + } + + configureProperties(this); + }; + + function makeGetter(arrayType) { + return function(byteOffset, littleEndian) { + + byteOffset = ECMAScript.ToUint32(byteOffset); + + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { + throw new RangeError("Array index out of range"); + } + byteOffset += this.byteOffset; + + var uint8Array = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT), + bytes = [], i; + for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { + bytes.push(r(uint8Array, i)); + } + + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { + bytes.reverse(); + } + + return r(new arrayType(new exports.Uint8Array(bytes).buffer), 0); + }; + } + + DataView.prototype.getUint8 = makeGetter(exports.Uint8Array); + DataView.prototype.getInt8 = makeGetter(exports.Int8Array); + DataView.prototype.getUint16 = makeGetter(exports.Uint16Array); + DataView.prototype.getInt16 = makeGetter(exports.Int16Array); + DataView.prototype.getUint32 = makeGetter(exports.Uint32Array); + DataView.prototype.getInt32 = makeGetter(exports.Int32Array); + DataView.prototype.getFloat32 = makeGetter(exports.Float32Array); + DataView.prototype.getFloat64 = makeGetter(exports.Float64Array); + + function makeSetter(arrayType) { + return function(byteOffset, value, littleEndian) { + + byteOffset = ECMAScript.ToUint32(byteOffset); + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { + throw new RangeError("Array index out of range"); + } + + // Get bytes + var typeArray = new arrayType([value]), + byteArray = new exports.Uint8Array(typeArray.buffer), + bytes = [], i, byteView; + + for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { + bytes.push(r(byteArray, i)); + } + + // Flip if necessary + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { + bytes.reverse(); + } + + // Write them + byteView = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT); + byteView.set(bytes); + }; + } + + DataView.prototype.setUint8 = makeSetter(exports.Uint8Array); + DataView.prototype.setInt8 = makeSetter(exports.Int8Array); + DataView.prototype.setUint16 = makeSetter(exports.Uint16Array); + DataView.prototype.setInt16 = makeSetter(exports.Int16Array); + DataView.prototype.setUint32 = makeSetter(exports.Uint32Array); + DataView.prototype.setInt32 = makeSetter(exports.Int32Array); + DataView.prototype.setFloat32 = makeSetter(exports.Float32Array); + DataView.prototype.setFloat64 = makeSetter(exports.Float64Array); + + exports.DataView = exports.DataView || DataView; + +}()); diff --git a/node_modules/typedarray/package.json b/node_modules/typedarray/package.json new file mode 100644 index 00000000..f04c3362 --- /dev/null +++ b/node_modules/typedarray/package.json @@ -0,0 +1,83 @@ +{ + "_from": "typedarray@^0.0.6", + "_id": "typedarray@0.0.6", + "_inBundle": false, + "_integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "_location": "/typedarray", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "typedarray@^0.0.6", + "name": "typedarray", + "escapedName": "typedarray", + "rawSpec": "^0.0.6", + "saveSpec": null, + "fetchSpec": "^0.0.6" + }, + "_requiredBy": [ + "/concat-stream" + ], + "_resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "_shasum": "867ac74e3864187b1d3d47d996a78ec5c8830777", + "_spec": "typedarray@^0.0.6", + "_where": "/home/remi/github/CPP_BIDS/node_modules/concat-stream", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/typedarray/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "TypedArray polyfill for old browsers", + "devDependencies": { + "tape": "~2.3.2" + }, + "homepage": "https://github.com/substack/typedarray", + "keywords": [ + "ArrayBuffer", + "DataView", + "Float32Array", + "Float64Array", + "Int8Array", + "Int16Array", + "Int32Array", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "Uint32Array", + "typed", + "array", + "polyfill" + ], + "license": "MIT", + "main": "index.js", + "name": "typedarray", + "repository": { + "type": "git", + "url": "git://github.com/substack/typedarray.git" + }, + "scripts": { + "test": "tape test/*.js test/server/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "0.0.6" +} diff --git a/node_modules/typedarray/readme.markdown b/node_modules/typedarray/readme.markdown new file mode 100644 index 00000000..d18f6f71 --- /dev/null +++ b/node_modules/typedarray/readme.markdown @@ -0,0 +1,61 @@ +# typedarray + +TypedArray polyfill ripped from [this +module](https://raw.github.com/inexorabletash/polyfill). + +[![build status](https://secure.travis-ci.org/substack/typedarray.png)](http://travis-ci.org/substack/typedarray) + +[![testling badge](https://ci.testling.com/substack/typedarray.png)](https://ci.testling.com/substack/typedarray) + +# example + +``` js +var Uint8Array = require('typedarray').Uint8Array; +var ua = new Uint8Array(5); +ua[1] = 256 + 55; +console.log(ua[1]); +``` + +output: + +``` +55 +``` + +# methods + +``` js +var TA = require('typedarray') +``` + +The `TA` object has the following constructors: + +* TA.ArrayBuffer +* TA.DataView +* TA.Float32Array +* TA.Float64Array +* TA.Int8Array +* TA.Int16Array +* TA.Int32Array +* TA.Uint8Array +* TA.Uint8ClampedArray +* TA.Uint16Array +* TA.Uint32Array + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install typedarray +``` + +To use this module in the browser, compile with +[browserify](http://browserify.org) +or download a UMD build from browserify CDN: + +http://wzrd.in/standalone/typedarray@latest + +# license + +MIT diff --git a/node_modules/typedarray/test/server/undef_globals.js b/node_modules/typedarray/test/server/undef_globals.js new file mode 100644 index 00000000..425950f9 --- /dev/null +++ b/node_modules/typedarray/test/server/undef_globals.js @@ -0,0 +1,19 @@ +var test = require('tape'); +var vm = require('vm'); +var fs = require('fs'); +var src = fs.readFileSync(__dirname + '/../../index.js', 'utf8'); + +test('u8a without globals', function (t) { + var c = { + module: { exports: {} }, + }; + c.exports = c.module.exports; + vm.runInNewContext(src, c); + var TA = c.module.exports; + var ua = new(TA.Uint8Array)(5); + + t.equal(ua.length, 5); + ua[1] = 256 + 55; + t.equal(ua[1], 55); + t.end(); +}); diff --git a/node_modules/typedarray/test/tarray.js b/node_modules/typedarray/test/tarray.js new file mode 100644 index 00000000..df596a34 --- /dev/null +++ b/node_modules/typedarray/test/tarray.js @@ -0,0 +1,10 @@ +var TA = require('../'); +var test = require('tape'); + +test('tiny u8a test', function (t) { + var ua = new(TA.Uint8Array)(5); + t.equal(ua.length, 5); + ua[1] = 256 + 55; + t.equal(ua[1], 55); + t.end(); +}); diff --git a/node_modules/unherit/index.js b/node_modules/unherit/index.js new file mode 100644 index 00000000..32ead777 --- /dev/null +++ b/node_modules/unherit/index.js @@ -0,0 +1,45 @@ +'use strict' + +var xtend = require('xtend') +var inherits = require('inherits') + +module.exports = unherit + +// Create a custom constructor which can be modified without affecting the +// original class. +function unherit(Super) { + var result + var key + var value + + inherits(Of, Super) + inherits(From, Of) + + // Clone values. + result = Of.prototype + + for (key in result) { + value = result[key] + + if (value && typeof value === 'object') { + result[key] = 'concat' in value ? value.concat() : xtend(value) + } + } + + return Of + + // Constructor accepting a single argument, which itself is an `arguments` + // object. + function From(parameters) { + return Super.apply(this, parameters) + } + + // Constructor accepting variadic arguments. + function Of() { + if (!(this instanceof Of)) { + return new From(arguments) + } + + return Super.apply(this, arguments) + } +} diff --git a/node_modules/unherit/license b/node_modules/unherit/license new file mode 100644 index 00000000..f3722d94 --- /dev/null +++ b/node_modules/unherit/license @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/unherit/package.json b/node_modules/unherit/package.json new file mode 100644 index 00000000..25be4c32 --- /dev/null +++ b/node_modules/unherit/package.json @@ -0,0 +1,112 @@ +{ + "_from": "unherit@^1.0.4", + "_id": "unherit@1.1.3", + "_inBundle": false, + "_integrity": "sha512-Ft16BJcnapDKp0+J/rqFC3Rrk6Y/Ng4nzsC028k2jdDII/rdZ7Wd3pPT/6+vIIxRagwRc9K0IUX0Ra4fKvw+WQ==", + "_location": "/unherit", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unherit@^1.0.4", + "name": "unherit", + "escapedName": "unherit", + "rawSpec": "^1.0.4", + "saveSpec": null, + "fetchSpec": "^1.0.4" + }, + "_requiredBy": [ + "/remark-parse", + "/remark-stringify" + ], + "_resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz", + "_shasum": "6c9b503f2b41b262330c80e91c8614abdaa69c22", + "_spec": "unherit@^1.0.4", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-parse", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/wooorm/unherit/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "inherits": "^2.0.0", + "xtend": "^4.0.0" + }, + "deprecated": false, + "description": "Clone a constructor without affecting the super-class", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^15.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.25.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "homepage": "https://github.com/wooorm/unherit#readme", + "keywords": [ + "clone", + "super", + "class", + "constructor" + ], + "license": "MIT", + "name": "unherit", + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/wooorm/unherit.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unherit -o unherit.js", + "build-mangle": "browserify . -s unherit -p tinyify -o unherit.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.3", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "unicorn/prefer-reflect-apply": "off", + "guard-for-in": "off" + }, + "ignores": [ + "unherit.js" + ] + } +} diff --git a/node_modules/unherit/readme.md b/node_modules/unherit/readme.md new file mode 100644 index 00000000..bf679597 --- /dev/null +++ b/node_modules/unherit/readme.md @@ -0,0 +1,79 @@ +# unherit + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] + +Create a custom constructor which can be modified without affecting the original +class. + +## Install + +[npm][]: + +```sh +npm install unherit +``` + +## Use + +```js +var EventEmitter = require('events').EventEmitter +var unherit = require('unherit') + +// Create a private class which acts just like `EventEmitter`. +var Emitter = unherit(EventEmitter) + +Emitter.prototype.defaultMaxListeners = 0 +// Now, all instances of `Emitter` have no maximum listeners, without affecting +// other `EventEmitter`s. + +new Emitter().defaultMaxListeners === 0 // => true +new EventEmitter().defaultMaxListeners === undefined // => true +new Emitter() instanceof EventEmitter // => true +``` + +## API + +### `unherit(Super)` + +Create a custom constructor which can be modified without affecting the original +class. + +###### Parameters + +* `Super` (`Function`) — Super-class + +###### Returns + +`Function` — Constructor acting like `Super`, which can be modified without +affecting the original class. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/wooorm/unherit.svg + +[build]: https://travis-ci.org/wooorm/unherit + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/unherit.svg + +[coverage]: https://codecov.io/github/wooorm/unherit + +[downloads-badge]: https://img.shields.io/npm/dm/unherit.svg + +[downloads]: https://www.npmjs.com/package/unherit + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unherit.svg + +[size]: https://bundlephobia.com/result?p=unherit + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com diff --git a/node_modules/unified-args/LICENSE b/node_modules/unified-args/LICENSE new file mode 100644 index 00000000..3f0166f6 --- /dev/null +++ b/node_modules/unified-args/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/unified-args/index.js b/node_modules/unified-args/index.js new file mode 100644 index 00000000..49e32cfb --- /dev/null +++ b/node_modules/unified-args/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = require('./lib/index.js'); diff --git a/node_modules/unified-args/lib/index.js b/node_modules/unified-args/lib/index.js new file mode 100644 index 00000000..a4d5b77c --- /dev/null +++ b/node_modules/unified-args/lib/index.js @@ -0,0 +1,156 @@ +'use strict'; + +var stream = require('stream'); +var engine = require('unified-engine'); +var chalk = require('chalk'); +var chokidar = require('chokidar'); +var options = require('./options'); + +module.exports = start; + +/* No-op. */ +var noop = Function.prototype; + +/* Fake TTY stream. */ +var ttyStream = new stream.Readable(); +ttyStream.isTTY = true; + +/* Exit, lazily, with the correct exit status code. */ +var exitStatus = 0; + +process.on('exit', onexit); + +/* Handle uncaught errors, such as from unexpected async + * behaviour. */ +process.on('uncaughtException', fail); + +/* Start the CLI. */ +function start(configuration) { + var config; + var output; + var watcher; + + try { + config = options(process.argv.slice(2), configuration); + } catch (err) { + return fail(err, true); + } + + if (config.help) { + process.stderr.write([ + 'Usage: ' + configuration.name + ' [options] [path | glob ...]', + '', + ' ' + configuration.description, + '', + 'Options:', + '', + config.helpMessage + ].join('\n') + '\n', noop); + + return; + } + + if (config.version) { + process.stderr.write(configuration.version + '\n', noop); + + return; + } + + /* Modify `config` for watching. */ + if (config.watch) { + output = config.output; + + /* Do not read from stdin(4). */ + config.streamIn = ttyStream; + + /* Do not write to stdout(4). */ + config.out = false; + + process.stderr.write( + chalk.bold('Watching...') + ' (press CTRL+C to exit)\n', + noop + ); + + /* Prevent infinite loop if set to regeneration. */ + if (output === true) { + config.output = false; + + process.stderr.write( + chalk.yellow('Note') + ': Ignoring `--output` until exit.\n', + noop + ); + } + } + + /* Subscribe a chokidar watcher to all processed files. */ + function subscribe(context) { + watcher = chokidar + .watch(context.fileSet.origins, { + cwd: config.cwd, + ignoreInitial: true + }) + .on('error', done) + .on('change', onchange); + + process.on('SIGINT', onsigint); + + function onchange(filePath) { + config.files = [filePath]; + + engine(config, done); + } + + function onsigint() { + /* Hide the `^C` in terminal. */ + process.stderr.write('\n', noop); + + clean(); + + /* Do another process if `output` specified regeneration. */ + if (output === true) { + config.output = output; + config.watch = false; + engine(config, done); + } + } + } + + /* Initial run */ + engine(config, done); + + /* Handle complete run. */ + function done(err, code, context) { + if (err) { + clean(); + fail(err); + } else { + exitStatus = code; + + if (config.watch && !watcher) { + subscribe(context); + } + } + } + + /* Clean the watcher. */ + function clean() { + if (watcher) { + watcher.close(); + watcher = null; + } + } +} + +/* Print an error, optionally with stack. */ +function fail(err, pretty) { + var message = (pretty ? String(err).trim() : err.stack) || err; + + exitStatus = 1; + + process.stderr.write(message.trim() + '\n', noop); +} + +function onexit() { + /* eslint-disable unicorn/no-process-exit */ + process.exit(exitStatus); +} diff --git a/node_modules/unified-args/lib/options.js b/node_modules/unified-args/lib/options.js new file mode 100644 index 00000000..60a01548 --- /dev/null +++ b/node_modules/unified-args/lib/options.js @@ -0,0 +1,277 @@ +'use strict'; + +var table = require('text-table'); +var camelcase = require('camelcase'); +var minimist = require('minimist'); +var json5 = require('json5'); +var schema = require('./schema'); + +module.exports = options; + +/* Schema for `minimist`. */ +var minischema = { + unknown: handleUnknownArgument, + default: {}, + alias: {}, + string: [], + boolean: [] +}; + +schema.forEach(addEach); + +/* Parse CLI options. */ +function options(flags, configuration) { + var extension = configuration.extensions[0]; + var name = configuration.name; + var config = toCamelCase(minimist(flags, minischema)); + var help; + var ext; + var report; + + schema.forEach(function (option) { + if (option.type === 'string' && config[option.long] === '') { + throw new Error('Missing value:' + inspect(option).join(' ')); + } + }); + + ext = extensions(config.ext); + report = reporter(config.report); + + help = inspectAll(schema) + [ + '', + '', + 'Examples:', + '', + ' # Process `input.' + extension + '`', + ' $ ' + name + ' input.' + extension + ' -o output.' + extension, + '', + ' # Pipe', + ' $ ' + name + ' < input.' + extension + ' > output.' + extension, + '', + ' # Rewrite all applicable files', + ' $ ' + name + ' . -o' + ].join('\n'); + + return { + helpMessage: help, + /* “hidden” feature, makes testing easier. */ + cwd: configuration.cwd, + processor: configuration.processor, + help: config.help, + version: config.version, + files: config._, + watch: config.watch, + extensions: ext.length ? ext : configuration.extensions, + output: config.output, + out: config.stdout, + tree: config.tree, + treeIn: config.treeIn, + treeOut: config.treeOut, + inspect: config.inspect, + rcName: configuration.rcName, + packageField: configuration.packageField, + rcPath: config.rcPath, + detectConfig: config.config, + settings: settings(config.setting), + ignoreName: configuration.ignoreName, + ignorePath: config.ignorePath, + detectIgnore: config.ignore, + pluginPrefix: configuration.pluginPrefix, + plugins: plugins(config.use), + reporter: report[0], + reporterOptions: report[1], + color: config.color, + silent: config.silent, + quiet: config.quiet, + frail: config.frail + }; +} + +function addEach(option) { + var value = option.default; + + minischema.default[option.long] = value === undefined ? null : value; + + if (option.type in minischema) { + minischema[option.type].push(option.long); + } + + if (option.short) { + minischema.alias[option.short] = option.long; + } +} + +/* Parse `extensions`. */ +function extensions(value) { + return flatten(normalize(value).map(splitList)); +} + +/* Parse `plugins`. */ +function plugins(value) { + var result = {}; + + normalize(value) + .map(splitOptions) + .forEach(function (value) { + result[value[0]] = value[1] ? parseConfig(value[1], {}) : null; + }); + + return result; +} + +/* Parse `reporter`: only one is accepted. */ +function reporter(value) { + var all = normalize(value) + .map(splitOptions) + .map(function (value) { + return [value[0], value[1] ? parseConfig(value[1], {}) : null]; + }); + + return all[all.length - 1] || []; +} + +/* Parse `settings`. */ +function settings(value) { + var cache = {}; + + normalize(value).forEach(function (value) { + parseConfig(value, cache); + }); + + return cache; +} + +/* Parse configuration. */ +function parseConfig(flags, cache) { + var flag; + var message; + + try { + flags = toCamelCase(parseJSON(flags)); + } catch (err) { + /* Fix position */ + message = err.message.replace(/at(?= position)/, 'around'); + + throw new Error('Cannot parse `' + flags + '` as JSON: ' + message); + } + + for (flag in flags) { + cache[flag] = flags[flag]; + } + + return cache; +} + +/* Handle an unknown flag. */ +function handleUnknownArgument(flag) { + /* Glob. */ + if (flag.charAt(0) !== '-') { + return; + } + + /* Long options. Always unknown. */ + if (flag.charAt(1) === '-') { + throw new Error('Unknown option `' + flag + '`, expected:\n' + inspectAll(schema)); + } + + /* Short options. Can be grouped. */ + flag.slice(1).split('').forEach(each); + + function each(key) { + var length = schema.length; + var index = -1; + var option; + + while (++index < length) { + option = schema[index]; + + if (option.short === key) { + return; + } + } + + throw new Error( + 'Unknown short option `-' + key + '`, ' + + 'expected:\n' + + inspectAll(schema.filter(short)) + ); + } + + function short(option) { + return option.short; + } +} + +/* Inspect all `options`. */ +function inspectAll(options) { + return table(options.map(inspect)); +} + +/* Inspect one `option`. */ +function inspect(option) { + var description = option.description; + var long = option.long; + + if (option.default === true || option.truelike) { + description += ' (on by default)'; + long = '[no-]' + long; + } + + return [ + '', + option.short ? '-' + option.short : '', + '--' + long + (option.value ? ' ' + option.value : ''), + description + ]; +} + +/* Normalize `value`. */ +function normalize(value) { + if (!value) { + return []; + } + + if (typeof value === 'string') { + return [value]; + } + + return flatten(value.map(normalize)); +} + +/* Flatten `values`. */ +function flatten(values) { + return [].concat.apply([], values); +} + +function splitOptions(value) { + return value.split('='); +} + +function splitList(value) { + return value.split(','); +} + +/* Transform the keys on an object to camel-case, + * recursivly. */ +function toCamelCase(object) { + var result = {}; + var value; + var key; + + for (key in object) { + value = object[key]; + + if (value && typeof value === 'object' && !('length' in value)) { + value = toCamelCase(value); + } + + result[camelcase(key)] = value; + } + + return result; +} + +/* Parse a (lazy?) JSON config. */ +function parseJSON(value) { + return json5.parse('{' + value + '}'); +} diff --git a/node_modules/unified-args/lib/schema.json b/node_modules/unified-args/lib/schema.json new file mode 100644 index 00000000..25617540 --- /dev/null +++ b/node_modules/unified-args/lib/schema.json @@ -0,0 +1,143 @@ +[ + { + "long": "help", + "description": "output usage information", + "short": "h", + "type": "boolean", + "default": false + }, + { + "long": "version", + "description": "output version number", + "short": "v", + "type": "boolean", + "default": false + }, + { + "long": "output", + "description": "specify output location", + "short": "o", + "value": "[path]" + }, + { + "long": "rc-path", + "description": "specify configuration file", + "short": "r", + "type": "string", + "value": "" + }, + { + "long": "ignore-path", + "description": "specify ignore file", + "short": "i", + "type": "string", + "value": "" + }, + { + "long": "setting", + "description": "specify settings", + "short": "s", + "type": "string", + "value": "" + }, + { + "long": "ext", + "description": "specify extensions", + "short": "e", + "type": "string", + "value": "" + }, + { + "long": "use", + "description": "use plugins", + "short": "u", + "type": "string", + "value": "" + }, + { + "long": "watch", + "description": "watch for changes and reprocess", + "short": "w", + "type": "boolean", + "default": false + }, + { + "long": "quiet", + "description": "output only warnings and errors", + "short": "q", + "type": "boolean", + "default": false + }, + { + "long": "silent", + "description": "output only errors", + "short": "S", + "type": "boolean", + "default": false + }, + { + "long": "frail", + "description": "exit with 1 on warnings", + "short": "f", + "type": "boolean", + "default": false + }, + { + "long": "tree", + "description": "specify input and output as syntax tree", + "short": "t", + "type": "boolean", + "default": false + }, + { + "long": "report", + "description": "specify reporter", + "type": "string", + "value": "" + }, + { + "long": "file-path", + "description": "specify path to process as", + "type": "string", + "value": "" + }, + { + "long": "tree-in", + "description": "specify input as syntax tree", + "type": "boolean" + }, + { + "long": "tree-out", + "description": "output syntax tree", + "type": "boolean" + }, + { + "long": "inspect", + "description": "output formatted syntax tree", + "type": "boolean" + }, + { + "long": "stdout", + "description": "specify writing to stdout", + "type": "boolean", + "truelike": true + }, + { + "long": "color", + "description": "specify color in report", + "type": "boolean", + "default": true + }, + { + "long": "config", + "description": "search for configuration files", + "type": "boolean", + "default": true + }, + { + "long": "ignore", + "description": "search for ignore files", + "type": "boolean", + "default": true + } +] diff --git a/node_modules/unified-args/package.json b/node_modules/unified-args/package.json new file mode 100644 index 00000000..7942a22d --- /dev/null +++ b/node_modules/unified-args/package.json @@ -0,0 +1,111 @@ +{ + "_from": "unified-args@^5.0.0", + "_id": "unified-args@5.1.0", + "_inBundle": false, + "_integrity": "sha512-IR8bS/qrfOMuIYrLlaXt+3L6cvDHv5YbBfYNVGBLbShUjE9vpbnUiPFMc/XKtH6oAGrD/m8lvVwCHDsFGBBzJA==", + "_location": "/unified-args", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unified-args@^5.0.0", + "name": "unified-args", + "escapedName": "unified-args", + "rawSpec": "^5.0.0", + "saveSpec": null, + "fetchSpec": "^5.0.0" + }, + "_requiredBy": [ + "/remark-cli" + ], + "_resolved": "https://registry.npmjs.org/unified-args/-/unified-args-5.1.0.tgz", + "_shasum": "1889200e072998a662e6e84d817d6f4b5f448dd1", + "_spec": "unified-args@^5.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-cli", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/unifiedjs/unified-args/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "camelcase": "^4.0.0", + "chalk": "^2.0.0", + "chokidar": "^1.5.1", + "json5": "^0.5.1", + "minimist": "^1.2.0", + "text-table": "^0.2.0", + "unified-engine": "^5.1.0" + }, + "deprecated": false, + "description": "Create CLIs for unified processors", + "devDependencies": { + "bail": "^1.0.0", + "execa": "^0.8.0", + "nyc": "^11.0.0", + "remark-cli": "^4.0.0", + "remark-preset-wooorm": "^3.0.0", + "strip-ansi": "^4.0.0", + "tape": "^4.4.0", + "touch": "^3.0.0", + "unified": "^6.0.0", + "vfile-reporter-json": "^1.0.1", + "xo": "^0.18.0", + "xtend": "^4.0.1" + }, + "files": [ + "index.js", + "lib/" + ], + "homepage": "https://github.com/unifiedjs/unified-args#readme", + "keywords": [ + "unified", + "processor", + "engine", + "cli", + "arguments" + ], + "license": "MIT", + "name": "unified-args", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/unifiedjs/unified-args.git" + }, + "scripts": { + "build": "npm run build-md", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test/index.js" + }, + "version": "5.1.0", + "xo": { + "space": true, + "esnext": false, + "rules": { + "guard-for-in": "off" + } + } +} diff --git a/node_modules/unified-args/readme.md b/node_modules/unified-args/readme.md new file mode 100644 index 00000000..2410eff5 --- /dev/null +++ b/node_modules/unified-args/readme.md @@ -0,0 +1,695 @@ +# unified-args [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +Interface for creating CLIs around [**unified**][unified] processors. +Wrapper around the [**engine**][engine] to configure it with command-line +arguments. Should be `require`d and configured in an executable script, +on its own, as it handles the whole process. + +[`unifiedjs.github.io`][site], the website for **unified** provides a good +overview about what unified can do. Make sure to visit it and try its +introductionary [Guides][]. + +## Installation + +[npm][]: + +```bash +npm install unified-args +``` + +## Usage + +This example creates a CLI for [**remark**][remark], loading +`remark-` plugins, searching for markdown files, and loading +[configuration][config-file] and [ignore][ignore-file] files. + +`cli` (you can make it runnable with: `chmod +x cli`): + +```js +#!/usr/bin/env node +'use strict'; + +var start = require('unified-args'); +var extensions = require('markdown-extensions'); +var remark = require('remark'); +var pack = require('remark/package.json'); + +var name = pack.name; + +start({ + processor: remark, + name: name, + description: pack.description, + version: pack.version, + pluginPrefix: name, + extensions: extensions, + packageField: name + 'Config', + rcName: '.' + name + 'rc', + ignoreName: '.' + name + 'ignore' +}); +``` + +## Table of Contents + +* [API](#api) + * [start(configuration)](#startconfiguration) +* [CLI](#cli) + * [--help](#--help) + * [--version](#--version) + * [--output \[path\]](#--output-path) + * [--rc-path <path>](#--rc-path-path) + * [--ignore-path <path>](#--ignore-path-path) + * [--setting <settings>](#--setting-settings) + * [--report <reporter>](#--report-reporter) + * [--use <plugin>](#--use-plugin) + * [--ext <extensions>](#--ext-extensions) + * [--watch](#--watch) + * [--tree](#--tree) + * [--tree-in](#--tree-in) + * [--tree-out](#--tree-out) + * [--inspect](#--inspect) + * [--quiet](#--quiet) + * [--silent](#--silent) + * [--frail](#--frail) + * [--file-path <path>](#--file-path-path) + * [--stdout](#--stdout) + * [--color](#--color) + * [--config](#--config) + * [--ignore](#--ignore) +* [Diagnostics](#diagnostics) +* [Debugging](#debugging) +* [Contribute](#contribute) +* [License](#license) + +## API + +### `start(configuration)` + +Create a CLI for a [**unified**][unified] processor. + +###### `configuration` + +All options are required. + +* `processor` ([`Processor`][unified-processor]) + — Processor to transform files + (engine: [`processor`][engine-processor]) +* `name` (`string`) + — Name of executable +* `description` (`string`) + — Description of executable +* `version` (`string`) + — Version of executable +* `extensions` (`Array.`) + — Default file [extensions][ext] to include + (engine: [`extensions`][engine-extensions]) +* `ignoreName` (`string`) + — Name of [ignore files][ignore-file] to load + (engine: [`ignoreName`][engine-ignore-name]) +* `rcName` (`string`) + — Name of [configuration files][config-file] to load + (engine: [`rcName`][engine-rc-name]) +* `packageField` (`string`) + — Property at which [configuration][config-file] can be found in + `package.json` files + (engine: [`packageField`][engine-package-field]) +* `pluginPrefix` (`string`) + — Prefix to use when searching for [plug-ins][use] + (engine: [`pluginPrefix`][engine-plugin-prefix]) + +## CLI + +CLIs created with **unified-args**, such as the [example][usage] above, +creates an interface similar to the below (run `cli --help` for accurate +information): + +```txt +Usage: remark [options] [path | glob ...] + + Markdown processor powered by plugins + +Options: + + -h --help output usage information + -v --version output version number + -o --output [path] specify output location + -r --rc-path specify configuration file + -i --ignore-path specify ignore file + -s --setting specify settings + -e --ext specify extensions + -u --use use plugins + -w --watch watch for changes and reprocess + -q --quiet output only warnings and errors + -S --silent output only errors + -f --frail exit with 1 on warnings + -t --tree specify input and output as syntax tree + --report specify reporter + --file-path specify path to process as + --tree-in specify input as syntax tree + --tree-out output syntax tree + --inspect output formatted syntax tree + --[no-]stdout specify writing to stdout (on by default) + --[no-]color specify color in report (on by default) + --[no-]config search for configuration files (on by default) + --[no-]ignore search for ignore files (on by default) + +Examples: + + # Process `input.md` + $ remark input.md -o output.md + + # Pipe + $ remark < input.md > output.md + + # Rewrite all applicable files + $ remark . -o +``` + +All non-options are seen as input and can be: + +* Paths (`cli README.txt`) and [globs][glob] (`cli *.txt`) pointing + to files to load +* Paths (`cli test`) and globs (`cli fixtures/{in,out}`) pointing to + directories. These are searched for files with known [extensions][ext] + which are not ignored by patterns in [ignore files][ignore-file]. + The default behaviour is to exclude files in `node_modules` + and hidden directories (those starting with a dot: `.`) unless explicitly + given + + + +* **Default**: none +* **Engine**: [`files`][engine-files] + +### `--help` + +```sh +cli --help +``` + +Output short usage information. + +* **Default**: off +* **Alias**: `-h` + +### `--version` + +```sh +cli --version +``` + +Output version number. + +* **Default**: off +* **Alias**: `-v` + +### `--output [path]` + +```sh +cli . --output +cli . --output doc +cli input.txt --output doc/output.text +``` + +Whether to write successfully processed files, and where to. Can be +set from [configuration files][config-file]. + +* If output is **not** given, files are not written to the file-system +* If output is given **without** `path`, input files are overwritten when + successful +* If output is given with `path` and it points to an existing directory, + files are written to that directory (intermediate directories are not + created) +* If output is given with `path`, the parent directory of that path + exists, and one file is processed, the file is written to the given + path + + + +* **Default**: off +* **Alias**: `-o` +* **Engine**: [`output`][engine-output] + +### `--rc-path ` + +```sh +cli . --rc-path config.json +``` + +File-path to a JSON [configuration file][config-file] to load, regardless +of [`--config`][config]. + +* **Default**: none +* **Alias**: `-r` +* **Engine**: [`rcPath`][engine-rc-path] + +### `--ignore-path ` + +```sh +cli . --ignore-path .gitignore +``` + +File-path to an [ignore file][ignore-file] to load, regardless of +[`--ignore`][ignore]. + +* **Default**: none +* **Alias**: `-i` +* **Engine**: [`ignorePath`][engine-ignore-path] + +### `--setting ` + +```sh +cli input.txt --setting alpha:true +cli input.txt --setting bravo:true --setting '"charlie": "delta"' +cli input.txt --setting echo-foxtrot:-2 +cli input.txt --setting 'golf: false, hotel-india: ["juliet", 1]' +``` + +Configuration for the parser and compiler of the processor. Can be set +from [configuration files][config-file]. + +The given settings are [JSON5][], with one exceptions: surrounding braces must +not be used: `"foo": 1, "bar": "baz"` is valid + +* **Default**: none +* **Alias**: `-s` +* **Engine**: [`settings`][engine-settings] + +### `--report ` + +```sh +cli input.txt --report ./reporter.js +cli input.txt --report vfile-reporter-json +cli input.txt --report json +cli input.txt --report json=pretty:2 +cli input.txt --report 'json=pretty:"\t"' +cli input.txt --report pretty --report json # only last one is used +``` + +[Reporter][] to load by its name or path, optionally with options, and use +to report metadata about eevery processed file. + +To pass options, follow the name by an equals sign (`=`) and settings, +which have the same in syntax as [`--setting `][setting]. + +The prefix `vfile-reporter-` can be omitted. Prefixed reporters are preferred +over modules without prefix. + +If multiple reporters are given, the last one is used. + +* **Default**: none, which uses [`vfile-reporter`][vfile-reporter]. +* **Engine**: [`reporter`][engine-reporter] and + [`reporterOptions`][engine-reporter-options]. + +###### Note + +The [`quiet`][quiet], [`silent`][silent], and [`color`][color] options may not +work with the used reporter. If they are given, they are preferred over the +same properties in reporter settings. + +### `--use ` + +```sh +cli input.txt --use man +cli input.txt --use 'toc=max-depth:3' +``` + +Plug-in to load by its name or path, optionally with options, and use +on every processed file. Can be set from [configuration files][config-file]. + +To pass options, follow the plugin by an equals sign (`=`) and settings, +which have the same in syntax as [`--setting `][setting]. + +Plug-ins prefixed with the [configured `pluginPrefix`][configured] are +preferred over modules without prefix. + +* **Default**: none +* **Alias**: `-u` +* **Engine**: [`plugins`][engine-plugins] + +### `--ext ` + +```sh +cli . --ext html +cli . --ext html,htm +``` + +Specify one or more extensions to include when searching for files. + +If no extensions are given, uses the [configured `extensions`][configured]. + +* **Default**: Configured [`extensions`][configured] +* **Alias**: `-e` +* **Engine**: [`extensions`][engine-extensions] + +### `--watch` + +```sh +cli . -qwo +``` + +Yields: + +```txt +Watching... (press CTRL+C to exit) +Note: Ignoring `--output` until exit. +``` + +Process as normal, then watch found files and reprocess when they change. + +The watch is stopped when `SIGINT` is received (usually done by pressing +`CTRL-C`). + +If [`--output`][output] is given **without** `path` it is not honoured, +to prevent an infinite loop. When the watch closes, a final process +runs including `--output`. + +* **Default**: off +* **Alias**: `-w` + +### `--tree` + +```sh +cli --tree < input.json > output.json +``` + +Treat input as a syntax tree in JSON and output the transformed syntax +tree. This runs neither the [parsing nor the compilation phase][description]. + +* **Default**: off +* **Alias**: `-t` +* **Engine**: [`tree`][engine-tree] + +### `--tree-in` + +```sh +cli --tree-in < input.json > input.txt +``` + +Treat input as a syntax tree in JSON. This does not run the [parsing +phase][description]. + +* **Default**: off +* **Engine**: [`treeIn`][engine-tree-in] + +### `--tree-out` + +```sh +cli --tree-out < input.txt > output.json +``` + +Output the transformed syntax tree. This does not run the [compilation +phase][description]. + +* **Default**: off +* **Engine**: [`treeOut`][engine-tree-out] + +### `--inspect` + +```sh +cli --inspect < input.txt +``` + +Output the transformed syntax tree, formatted with +[`unist-util-inspect`][inspect]. +This does not run the [compilation phase][description]. + +* **Default**: off +* **Engine**: [`inspect`][engine-inspect] + +### `--quiet` + +```sh +cli input.txt --quiet +``` + +Ignore files without any messages in the report. The default behaviour +is to show a success message. + +* **Default**: off +* **Alias**: `-q` +* **Engine**: [`quiet`][engine-quiet] + +###### Note + +This option may not work depending on the reporter given in +[`--report`][report]. + +###### Note + +The [`quiet`][quiet], [`silent`][silent], and [`color`][color] options may not +work with the used reporter. + +### `--silent` + +```sh +cli input.txt --silent +``` + +Show only fatal errors in the report. Turns [`--quiet`][quiet] on. + +* **Default**: off +* **Alias**: `-S` +* **Engine**: [`silent`][engine-silent] + +###### Note + +This option may not work depending on the reporter given in +[`--report`][report]. + +### `--frail` + +```sh +cli input.txt --frail +``` + +Exit with a status code of `1` if warnings or errors occur. The default +behaviour is to exit with `1` on errors. + +* **Default**: off +* **Alias**: `-f` +* **Engine**: [`frail`][engine-frail] + +### `--file-path ` + +```sh +cli --file-path input.txt < input.txt > doc/output.txt +``` + +File path to process the given file on **stdin**(4) as, if any. + +* **Default**: none +* **Engine**: [`filePath`][engine-file-path] + +### `--stdout` + +```sh +cli input.txt --no-stdout +``` + +Whether to write a processed file to **stdout**(4). + +* **Default**: off if [`--output`][output] or [`--watch`][watch] are given, + or if multiple files could be processed +* **Engine**: [`out`][engine-out] + +### `--color` + +```sh +cli input.txt --no-color +``` + +Whether to output ANSI color codes in the report. + +* **Default**: whether the terminal [supports colour][supports-color] +* **Engine**: [`color`][engine-color] + +###### Note + +This option may not work depending on the reporter given in +[`--report`][report]. + +### `--config` + +```sh +cli input.txt --no-config +``` + +Whether to load [configuration files][config-file]. + +Searches for files with the [configured `rcName`][configured]: `$rcName` (JSON), +`$rcName.js` (JavaScript), `$rcName.yml` (YAML), and `$rcName.yaml` (YAML); and +looks for the [configured `packageField`][configured] in `package.json` files. + +* **Default**: on +* **Engine**: [`detectConfig`][engine-detect-config] + +### `--ignore` + +```sh +cli . --no-ignore +``` + +Whether to load [ignore files][ignore-file]. + +Searches for files named [`$ignoreName`][configured]. + +* **Default**: on +* **Engine**: [`detectIgnore`][engine-detect-ignore] + +## Diagnostics + +CLIs created with **unified-args** exit with: + +* `1` on fatal errors +* `1` on warnings in [`--frail`][frail] mode, `0` on warnings otherwise +* `0` on success + +## Debugging + +CLIs can be debugged by setting the [`DEBUG`][debug] environment +variable to `*`, such as `DEBUG="*" cli example.txt`. + +## Contribute + +See [`contribute.md` in `unifiedjs/unified`][contribute] for ways to get +started. + +This organisation has a [Code of Conduct][coc]. By interacting with this +repository, organisation, or community you agree to abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/unifiedjs/unified-args.svg + +[travis]: https://travis-ci.org/unifiedjs/unified-args + +[codecov-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified-args.svg + +[codecov]: https://codecov.io/github/unifiedjs/unified-args + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[debug]: https://github.com/visionmedia/debug#debug + +[glob]: https://github.com/isaacs/node-glob#glob-primer + +[supports-color]: https://github.com/chalk/supports-color + +[unified]: https://github.com/unifiedjs/unified + +[engine]: https://github.com/unifiedjs/unified-engine + +[unified-processor]: https://github.com/unifiedjs/unified#processor + +[remark]: https://github.com/remarkjs/remark + +[config-file]: https://github.com/unifiedjs/unified-engine/blob/master/doc/configure.md + +[ignore-file]: https://github.com/unifiedjs/unified-engine/blob/master/doc/ignore.md + +[description]: https://github.com/unifiedjs/unified#description + +[engine-processor]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsprocessor + +[engine-files]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsfiles + +[engine-output]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsoutput + +[engine-rc-path]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsrcpath + +[engine-rc-name]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsrcname + +[engine-package-field]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionspackagefield + +[engine-ignore-name]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsignorename + +[engine-ignore-path]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsignorepath + +[engine-reporter]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsreporter + +[engine-reporter-options]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsreporteroptions + +[engine-settings]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionssettings + +[engine-plugins]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsplugins + +[engine-plugin-prefix]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionspluginprefix + +[engine-extensions]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsextensions + +[engine-tree]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionstree + +[engine-tree-in]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionstreein + +[engine-tree-out]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionstreeout + +[engine-inspect]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsinspect + +[engine-quiet]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsquiet + +[engine-silent]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsilent + +[engine-frail]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsfrail + +[engine-file-path]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsfilepath + +[engine-out]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsout + +[engine-color]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionscolor + +[engine-detect-config]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsdetectconfig + +[engine-detect-ignore]: https://github.com/unifiedjs/unified-engine/blob/master/doc/options.md#optionsdetectignore + +[configured]: #startconfiguration + +[usage]: #usage + +[watch]: #--watch + +[output]: #--output-path + +[config]: #--config + +[ext]: #--ext-extensions + +[use]: #--use-plugin + +[ignore]: #--ignore + +[setting]: #--setting-settings + +[report]: #--report-reporter + +[quiet]: #--quiet + +[silent]: #--silent + +[color]: #--color + +[frail]: #--frail + +[site]: https://unifiedjs.github.io + +[guides]: https://unifiedjs.github.io/#guides + +[reporter]: https://github.com/vfile/vfile#reporters + +[vfile-reporter]: https://github.com/vfile/vfile-reporter + +[inspect]: https://github.com/syntax-tree/unist-util-inspect + +[json5]: https://github.com/json5/json5 + +[contribute]: https://github.com/unifiedjs/unified/blob/master/contributing.md + +[coc]: https://github.com/unifiedjs/unified/blob/master/code-of-conduct.md diff --git a/node_modules/unified-engine/LICENSE b/node_modules/unified-engine/LICENSE new file mode 100644 index 00000000..3f0166f6 --- /dev/null +++ b/node_modules/unified-engine/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/unified-engine/lib/configuration.js b/node_modules/unified-engine/lib/configuration.js new file mode 100644 index 00000000..81cbbbc8 --- /dev/null +++ b/node_modules/unified-engine/lib/configuration.js @@ -0,0 +1,276 @@ +'use strict'; + +var path = require('path'); +var Module = require('module'); +var yaml = require('js-yaml'); +var json = require('parse-json'); +var debug = require('debug')('unified-engine:configuration'); +var resolve = require('load-plugin').resolve; +var fault = require('fault'); +var xtend = require('xtend'); +var object = require('is-object'); +var string = require('x-is-string'); +var func = require('x-is-function'); +var FindUp = require('./find-up'); + +module.exports = Config; + +var own = {}.hasOwnProperty; +var extname = path.extname; +var basename = path.basename; +var dirname = path.dirname; +var relative = path.relative; + +var loaders = { + '.json': loadJSON, + '.js': loadScript, + '.yaml': loadYAML, + '.yml': loadYAML +}; + +var defaultLoader = loadJSON; + +Config.prototype.load = load; + +function Config(options) { + var rcName = options.rcName; + var packageField = options.packageField; + var names = []; + + this.cwd = options.cwd; + this.packageField = options.packageField; + this.pluginPrefix = options.pluginPrefix; + this.configTransform = options.configTransform; + this.defaultConfig = options.defaultConfig; + + if (rcName) { + names.push(rcName, rcName + '.js', rcName + '.yml', rcName + '.yaml'); + debug('Looking for `%s` configuration files', names); + } + + if (packageField) { + names.push('package.json'); + debug('Looking for `%s` fields in `package.json` files', packageField); + } + + this.given = {settings: options.settings, plugins: options.plugins}; + this.create = create.bind(this); + + this.findUp = new FindUp({ + filePath: options.rcPath, + cwd: options.cwd, + detect: options.detectConfig, + names: names, + create: this.create + }); +} + +function load(filePath, callback) { + var searchPath = filePath || path.resolve(this.cwd, 'stdin.js'); + var self = this; + + self.findUp.load(searchPath, done); + + function done(err, res) { + if (err || res) { + return callback(err, res); + } + + callback(null, self.create()); + } +} + +function create(buf, filePath) { + var self = this; + var transform = self.configTransform; + var defaults = self.defaultConfig; + var fn = (filePath && loaders[extname(filePath)]) || defaultLoader; + var options = {prefix: self.pluginPrefix, cwd: self.cwd}; + var result = {settings: {}, plugins: []}; + var contents = buf ? fn.apply(self, arguments) : undefined; + + if (transform && contents !== undefined) { + contents = transform(contents, filePath); + } + + /* Exit if we did find a `package.json`, but it doesn’t have configuration. */ + if (buf && contents === undefined && basename(filePath) === 'package.json') { + return; + } + + if (contents === undefined) { + if (defaults) { + merge(result, defaults, null, xtend(options, {root: self.cwd})); + } + } else { + merge(result, contents, null, xtend(options, {root: dirname(filePath)})); + } + + merge(result, self.given, null, xtend(options, {root: self.cwd})); + + return result; +} + +/* Basically `Module.prototype.load`, but for a buffer instead + * of a filepath. */ +function loadScript(buf, filePath) { + var submodule = Module._cache[filePath]; + + if (!submodule) { + submodule = new Module(filePath, module); + submodule.filename = filePath; + submodule.paths = Module._nodeModulePaths(dirname(filePath)); + submodule._compile(String(buf), filePath); + submodule.loaded = true; + Module._cache[filePath] = submodule; + } + + return submodule.exports; +} + +function loadYAML(buf, filePath) { + return yaml.safeLoad(buf, {filename: basename(filePath)}); +} + +function loadJSON(buf, filePath) { + var result = json(buf, filePath); + + if (basename(filePath) === 'package.json') { + result = result[this.packageField]; + } + + return result; +} + +function merge(target, raw, val, options) { + var root = options.root; + var cwd = options.cwd; + var prefix = options.prefix; + + if (object(raw)) { + addPreset(raw); + } else { + throw new Error('Expected preset, not `' + raw + '`'); + } + + return target; + + function addPreset(result) { + var plugins = result.plugins; + + if (plugins === null || plugins === undefined) { + /* Empty. */ + } else if (object(plugins)) { + if ('length' in plugins) { + addEach(plugins); + } else { + addIn(plugins); + } + } else { + throw new Error('Expected a list or object of plugins, not `' + plugins + '`'); + } + + target.settings = xtend(target.settings, result.settings); + } + + function addEach(result) { + var length = result.length; + var index = -1; + var value; + + while (++index < length) { + value = result[index]; + + if (object(value) && 'length' in value) { + use.apply(null, value); + } else { + use(value); + } + } + } + + function addIn(result) { + var key; + + for (key in result) { + use(key, result[key]); + } + } + + function use(usable, value) { + if (string(usable)) { + addModule(usable, value); + } else if (func(usable)) { + addPlugin(usable, value); + } else { + merge(target, usable, value, options); + } + } + + function addModule(id, value) { + var fp = resolve(id, {cwd: root, prefix: prefix}); + var res; + + if (fp) { + try { + res = require(fp); // eslint-disable-line import/no-dynamic-require + } catch (err) { + throw fault('Cannot parse script `%s`\n%s', relative(root, fp), err.stack); + } + + try { + if (func(res)) { + addPlugin(res, value); + } else { + merge(target, res, value, xtend(options, {root: dirname(fp)})); + } + } catch (err) { + throw fault('Error: Expected preset or plugin, not %s, at `%s`', res, relative(root, fp)); + } + } else { + fp = relative(cwd, path.resolve(root, id)); + addPlugin(failingModule(fp, new Error('Could not find module `' + id + '`')), value); + } + } + + function addPlugin(result, value) { + var entry = find(target.plugins, result); + + if (entry) { + reconfigure(entry, value); + } else { + target.plugins.push([result, value]); + } + } +} + +function reconfigure(entry, value) { + if (value !== false && entry[1] !== false && object(value)) { + value = xtend(entry[1], value); + } + + entry[1] = value; +} + +function find(entries, plugin) { + var length = entries.length; + var index = -1; + var entry; + + while (++index < length) { + entry = entries[index]; + + if (entry[0] === plugin) { + return entry; + } + } +} + +function failingModule(id, err) { + var cache = failingModule.cache || (failingModule.cache = {}); + var submodule = own.call(cache, id) ? cache[id] : (cache[id] = fail); + return submodule; + function fail() { + throw err; + } +} diff --git a/node_modules/unified-engine/lib/file-pipeline/configure.js b/node_modules/unified-engine/lib/file-pipeline/configure.js new file mode 100644 index 00000000..dba4dba0 --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/configure.js @@ -0,0 +1,70 @@ +'use strict'; + +var debug = require('debug')('unified-engine:file-pipeline:configure'); +var stats = require('vfile-statistics'); +var fnName = require('fn-name'); +var object = require('is-object'); +var empty = require('is-empty'); + +module.exports = configure; + +/* Collect configuration for a file based on the context. */ +function configure(context, file, fileSet, next) { + var config = context.configuration; + var processor = context.processor; + + if (stats(file).fatal) { + return next(); + } + + config.load(file.path, handleConfiguration); + + function handleConfiguration(err, configuration) { + var plugins; + var options; + var plugin; + var length; + var index; + var name; + + if (err) { + return next(err); + } + + /* Store configuration on the context object. */ + debug('Using settings `%j`', configuration.settings); + processor.data('settings', configuration.settings); + + plugins = configuration.plugins; + length = plugins.length; + index = -1; + + debug('Using `%d` plugins', length); + + while (++index < length) { + plugin = plugins[index][0]; + options = plugins[index][1]; + + if (options === false) { + continue; + } + + /* Allow for default arguments in es2020. */ + if (options === null || (object(options) && empty(options))) { + options = undefined; + } + + name = fnName(plugin) || 'function'; + debug('Using plug-in `%s`, with options `%j`', name, options); + + try { + processor.use(plugin, options, fileSet); + } catch (err) { + /* istanbul ignore next - Shouldn’t happen anymore! */ + return next(err); + } + } + + next(); + } +} diff --git a/node_modules/unified-engine/lib/file-pipeline/copy.js b/node_modules/unified-engine/lib/file-pipeline/copy.js new file mode 100644 index 00000000..b08add84 --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/copy.js @@ -0,0 +1,67 @@ +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var debug = require('debug')('unified-engine:file-pipeline:copy'); +var string = require('x-is-string'); + +module.exports = copy; + +var stat = fs.stat; +var dirname = path.dirname; +var resolve = path.resolve; +var relative = path.relative; + +/* Move a file. */ +function copy(context, file, fileSet, next) { + var output = context.output; + var multi = fileSet.expected > 1; + var outpath = output; + var currentPath = file.path; + + if (!string(outpath)) { + debug('Not copying'); + return next(); + } + + outpath = resolve(context.cwd, outpath); + + debug('Copying `%s`', currentPath); + + stat(outpath, onstatfile); + + function onstatfile(err, stats) { + if (err) { + if (err.code !== 'ENOENT' || output.charAt(output.length - 1) === path.sep) { + return next(new Error('Cannot read output directory. Error:\n' + err.message)); + } + + stat(dirname(outpath), onstatparent); + } else { + done(stats.isDirectory()); + } + } + + /* This is either given an error, or the parent exists which + * is a directory, but we should keep the basename of the + * given file. */ + function onstatparent(err) { + if (err) { + next(new Error('Cannot read parent directory. Error:\n' + err.message)); + } else { + done(false); + } + } + + function done(directory) { + if (!directory && multi) { + return next(new Error('Cannot write multiple files to single output: ' + outpath)); + } + + file[directory ? 'dirname' : 'path'] = relative(file.cwd, outpath); + + debug('Copying document from %s to %s', currentPath, file.path); + + next(); + } +} diff --git a/node_modules/unified-engine/lib/file-pipeline/file-system.js b/node_modules/unified-engine/lib/file-pipeline/file-system.js new file mode 100644 index 00000000..cdb7347d --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/file-system.js @@ -0,0 +1,40 @@ +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var debug = require('debug')('unified-engine:file-pipeline:file-system'); + +module.exports = fileSystem; + +var writeFile = fs.writeFile; +var resolve = path.resolve; + +/* Write a virtual file to the file-system. + * Ignored when `output` is not given. */ +function fileSystem(context, file, fileSet, next) { + var destinationPath; + + if (!context.output) { + debug('Ignoring writing to file-system'); + return next(); + } + + if (!file.data.unifiedEngineGiven) { + debug('Ignoring programmatically added file'); + return next(); + } + + destinationPath = file.path; + + if (!destinationPath) { + debug('Cannot write file without a `destinationPath`'); + return next(new Error('Cannot write file without an output path ')); + } + + destinationPath = resolve(context.cwd, destinationPath); + debug('Writing document to `%s`', destinationPath); + + file.stored = true; + + writeFile(destinationPath, file.toString(), next); +} diff --git a/node_modules/unified-engine/lib/file-pipeline/index.js b/node_modules/unified-engine/lib/file-pipeline/index.js new file mode 100644 index 00000000..fa0c37ae --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/index.js @@ -0,0 +1,50 @@ +'use strict'; + +var trough = require('trough'); +var read = require('./read'); +var configure = require('./configure'); +var parse = require('./parse'); +var transform = require('./transform'); +var queue = require('./queue'); +var stringify = require('./stringify'); +var copy = require('./copy'); +var stdout = require('./stdout'); +var fileSystem = require('./file-system'); + +/* Expose: This pipeline ensures each of the pipes + * always runs: even if the read pipe fails, + * queue and write trigger. */ +module.exports = trough() + .use(chunk(trough().use(read).use(configure).use(parse).use(transform))) + .use(chunk(trough().use(queue))) + .use(chunk(trough().use(stringify).use(copy).use(stdout).use(fileSystem))); + +/* Factory to run a pipe. Wraps a pipe to trigger an + * error on the `file` in `context`, but still call + * `next`. */ +function chunk(pipe) { + return run; + + /* Run the bound bound pipe and handles any errors. */ + function run(context, file, fileSet, next) { + pipe.run(context, file, fileSet, one); + + function one(err) { + var messages = file.messages; + var index; + + if (err) { + index = messages.indexOf(err); + + if (index === -1) { + err = file.message(err); + index = messages.length - 1; + } + + messages[index].fatal = true; + } + + next(); + } + } +} diff --git a/node_modules/unified-engine/lib/file-pipeline/parse.js b/node_modules/unified-engine/lib/file-pipeline/parse.js new file mode 100644 index 00000000..42713a78 --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/parse.js @@ -0,0 +1,44 @@ +'use strict'; + +var debug = require('debug')('unified-engine:file-pipeline:parse'); +var stats = require('vfile-statistics'); +var json = require('parse-json'); + +module.exports = parse; + +/* Fill a file with a tree. */ +function parse(context, file) { + var message; + + if (stats(file).fatal) { + return; + } + + if (context.treeIn) { + debug('Not parsing already parsed document'); + + try { + context.tree = json(file.toString()); + } catch (err) { + message = file.message(new Error('Cannot read file as JSON\n' + err.message)); + message.fatal = true; + } + + /* Add the preferred extension to ensure the file, when compiled, is + * correctly recognized. Only add it if there’s a path — not if the + * file is for example stdin. */ + if (file.path) { + file.extname = context.extensions[0]; + } + + file.contents = ''; + + return; + } + + debug('Parsing `%s`', file.path); + + context.tree = context.processor.parse(file); + + debug('Parsed document'); +} diff --git a/node_modules/unified-engine/lib/file-pipeline/queue.js b/node_modules/unified-engine/lib/file-pipeline/queue.js new file mode 100644 index 00000000..cb2124c6 --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/queue.js @@ -0,0 +1,60 @@ +'use strict'; + +var debug = require('debug')('unified-engine:file-pipeline:queue'); +var stats = require('vfile-statistics'); +var func = require('x-is-function'); + +module.exports = queue; + +/* Queue all files which came this far. + * When the last file gets here, run the file-set pipeline + * and flush the queue. */ +function queue(context, file, fileSet, next) { + var origin = file.history[0]; + var map = fileSet.complete; + var complete = true; + + if (!map) { + map = {}; + fileSet.complete = map; + } + + debug('Queueing `%s`', origin); + + map[origin] = next; + + fileSet.valueOf().forEach(each); + + if (!complete) { + debug('Not flushing: some files cannot be flushed'); + return; + } + + fileSet.complete = {}; + + fileSet.pipeline.run(fileSet, done); + + function each(file) { + var key = file.history[0]; + + if (stats(file).fatal) { + return; + } + + if (func(map[key])) { + debug('`%s` can be flushed', key); + } else { + debug('Interupting flush: `%s` is not finished', key); + complete = false; + } + } + + function done(err) { + debug('Flushing: all files can be flushed'); + + /* Flush. */ + for (origin in map) { + map[origin](err); + } + } +} diff --git a/node_modules/unified-engine/lib/file-pipeline/read.js b/node_modules/unified-engine/lib/file-pipeline/read.js new file mode 100644 index 00000000..d3a6ca38 --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/read.js @@ -0,0 +1,36 @@ +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var debug = require('debug')('unified-engine:file-pipeline:read'); +var stats = require('vfile-statistics'); + +module.exports = read; + +var resolve = path.resolve; +var readFile = fs.readFile; + +/* Fill a file with its contents when not already filled. */ +function read(context, file, fileSet, next) { + var filePath = file.path; + + if (file.contents || file.data.unifiedEngineStreamIn) { + debug('Not reading file `%s` with contents', filePath); + next(); + } else if (stats(file).fatal) { + debug('Not reading failed file `%s`', filePath); + next(); + } else { + filePath = resolve(context.cwd, filePath); + + debug('Reading `%s` in `%s`', filePath, 'utf8'); + + readFile(filePath, 'utf8', function (err, contents) { + debug('Read `%s` (err: %s)', filePath, err); + + file.contents = contents || ''; + + next(err); + }); + } +} diff --git a/node_modules/unified-engine/lib/file-pipeline/stdout.js b/node_modules/unified-engine/lib/file-pipeline/stdout.js new file mode 100644 index 00000000..e48b0d11 --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/stdout.js @@ -0,0 +1,22 @@ +'use strict'; + +var debug = require('debug')('unified-engine:file-pipeline:stdout'); +var stats = require('vfile-statistics'); + +module.exports = stdout; + +/* Write a virtual file to `streamOut`. + * Ignored when `output` is given, more than one file + * was processed, or `out` is false. */ +function stdout(context, file, fileSet, next) { + if (!file.data.unifiedEngineGiven) { + debug('Ignoring programmatically added file'); + next(); + } else if (stats(file).fatal || context.output || !context.out) { + debug('Ignoring writing to `streamOut`'); + next(); + } else { + debug('Writing document to `streamOut`'); + context.streamOut.write(file.toString(), next); + } +} diff --git a/node_modules/unified-engine/lib/file-pipeline/stringify.js b/node_modules/unified-engine/lib/file-pipeline/stringify.js new file mode 100644 index 00000000..54647bab --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/stringify.js @@ -0,0 +1,50 @@ +'use strict'; + +var debug = require('debug')('unified-engine:file-pipeline:stringify'); +var stats = require('vfile-statistics'); +var inspect = require('unist-util-inspect'); + +module.exports = stringify; + +/* Stringify a tree. */ +function stringify(context, file) { + var processor = context.processor; + var tree = context.tree; + var value; + + if (stats(file).fatal) { + debug('Not compiling failed document'); + return; + } + + if (!context.output && !context.out && !context.alwaysStringify) { + debug('Not compiling document without output settings'); + return; + } + + debug('Compiling `%s`', file.path); + + if (context.inspect) { + /* Add a `txt` extension if there’s a path. */ + if (file.path) { + file.extname = '.txt'; + } + + value = inspect[context.color ? 'color' : 'noColor'](tree) + '\n'; + } else if (context.treeOut) { + /* Add a `json` extension to ensure the file is correctly seen as JSON. + * Only add it if there’s a path — not if the file is for example stdin. */ + if (file.path) { + file.extname = '.json'; + } + + /* Add the line break to create a valid UNIX file. */ + value = JSON.stringify(tree, null, 2) + '\n'; + } else { + value = processor.stringify(tree, file); + } + + file.contents = value; + + debug('Compiled document'); +} diff --git a/node_modules/unified-engine/lib/file-pipeline/transform.js b/node_modules/unified-engine/lib/file-pipeline/transform.js new file mode 100644 index 00000000..ae917691 --- /dev/null +++ b/node_modules/unified-engine/lib/file-pipeline/transform.js @@ -0,0 +1,23 @@ +'use strict'; + +var debug = require('debug')('unified-engine:file-pipeline:transform'); +var stats = require('vfile-statistics'); + +module.exports = transform; + +/* Transform the tree associated with a file with + * configured plug-ins. */ +function transform(context, file, fileSet, next) { + if (stats(file).fatal) { + next(); + return; + } + + debug('Transforming document `%s`', file.path); + + context.processor.run(context.tree, file, function (err, node) { + debug('Transformed document (error: %s)', err); + context.tree = node; + next(err); + }); +} diff --git a/node_modules/unified-engine/lib/file-set-pipeline/configure.js b/node_modules/unified-engine/lib/file-set-pipeline/configure.js new file mode 100644 index 00000000..82bec65f --- /dev/null +++ b/node_modules/unified-engine/lib/file-set-pipeline/configure.js @@ -0,0 +1,9 @@ +'use strict'; + +var Configuration = require('../configuration'); + +module.exports = configure; + +function configure(context, settings) { + context.configuration = new Configuration(settings); +} diff --git a/node_modules/unified-engine/lib/file-set-pipeline/file-system.js b/node_modules/unified-engine/lib/file-set-pipeline/file-system.js new file mode 100644 index 00000000..f45cde1a --- /dev/null +++ b/node_modules/unified-engine/lib/file-set-pipeline/file-system.js @@ -0,0 +1,55 @@ +'use strict'; + +var Ignore = require('../ignore'); +var find = require('../finder'); + +module.exports = fileSystem; + +/* Find files from the file-system. */ +function fileSystem(context, settings, next) { + var input = context.files; + var skip = settings.silentlyIgnore; + var ignore = new Ignore({ + cwd: settings.cwd, + detectIgnore: settings.detectIgnore, + ignoreName: settings.ignoreName, + ignorePath: settings.ignorePath + }); + + if (input.length === 0) { + return next(); + } + + find(input, { + cwd: settings.cwd, + extensions: settings.extensions, + silentlyIgnore: skip, + ignore: ignore + }, found); + + function found(err, result) { + var output = result.files; + + /* Sort alphabetically. Everything’s unique so we don’t care + * about cases where left and right are equal. */ + output.sort(function (left, right) { + return left.path < right.path ? -1 : 1; + }); + + /* Mark as given. This allows outputting files, + * which can be pretty dangerous, so it’s “hidden”. */ + output.forEach(function (file) { + file.data.unifiedEngineGiven = true; + }); + + context.files = output; + + /* If `out` wasn’t set, detect it based on + * whether one file was given. */ + if (settings.out === null || settings.out === undefined) { + settings.out = result.oneFileMode; + } + + next(err); + } +} diff --git a/node_modules/unified-engine/lib/file-set-pipeline/index.js b/node_modules/unified-engine/lib/file-set-pipeline/index.js new file mode 100644 index 00000000..2d25f9a7 --- /dev/null +++ b/node_modules/unified-engine/lib/file-set-pipeline/index.js @@ -0,0 +1,15 @@ +'use strict'; + +var trough = require('trough'); +var configure = require('./configure'); +var fileSystem = require('./file-system'); +var stdin = require('./stdin'); +var transform = require('./transform'); +var log = require('./log'); + +module.exports = trough() + .use(configure) + .use(fileSystem) + .use(stdin) + .use(transform) + .use(log); diff --git a/node_modules/unified-engine/lib/file-set-pipeline/log.js b/node_modules/unified-engine/lib/file-set-pipeline/log.js new file mode 100644 index 00000000..a422efb5 --- /dev/null +++ b/node_modules/unified-engine/lib/file-set-pipeline/log.js @@ -0,0 +1,44 @@ +'use strict'; + +var xtend = require('xtend'); +var load = require('load-plugin'); +var report = require('vfile-reporter'); +var string = require('x-is-string'); + +module.exports = log; + +var prefix = 'vfile-reporter'; + +function log(context, settings, next) { + var reporter = settings.reporter || report; + var diagnostics; + + if (string(reporter)) { + try { + reporter = load(reporter, {cwd: settings.cwd, prefix: prefix}); + } catch (err) { + next(new Error('Could not find reporter `' + reporter + '`')); + return; + } + } + + diagnostics = reporter(context.files.filter(given), xtend(settings.reporterOptions, { + quiet: settings.quiet, + silent: settings.silent, + color: settings.color + })); + + if (diagnostics) { + if (diagnostics.charAt(diagnostics.length - 1) !== '\n') { + diagnostics += '\n'; + } + + settings.streamError.write(diagnostics, next); + } else { + next(); + } +} + +function given(file) { + return file.data.unifiedEngineGiven; +} diff --git a/node_modules/unified-engine/lib/file-set-pipeline/stdin.js b/node_modules/unified-engine/lib/file-set-pipeline/stdin.js new file mode 100644 index 00000000..6a42b720 --- /dev/null +++ b/node_modules/unified-engine/lib/file-set-pipeline/stdin.js @@ -0,0 +1,56 @@ +'use strict'; + +var debug = require('debug')('unified-engine:file-set-pipeline:stdin'); +var vfile = require('to-vfile'); +var concat = require('concat-stream'); + +module.exports = stdin; + +function stdin(context, settings, next) { + var streamIn = settings.streamIn; + var err; + + if (settings.files && settings.files.length !== 0) { + debug('Ignoring `streamIn`'); + + if (settings.filePath) { + err = new Error( + 'Do not pass both `--file-path` and real files.\n' + + 'Did you mean to pass stdin instead of files?' + ); + } + + next(err); + + return; + } + + if (streamIn.isTTY) { + debug('Cannot read from `tty` stream'); + next(new Error('No input')); + + return; + } + + debug('Reading from `streamIn`'); + + streamIn.pipe(concat({encoding: 'string'}, read)); + + function read(value) { + var file = vfile(settings.filePath || undefined); + + debug('Read from `streamIn`'); + + file.cwd = settings.cwd; + file.contents = value; + file.data.unifiedEngineGiven = true; + file.data.unifiedEngineStreamIn = true; + + context.files = [file]; + + /* If `out` wasn’t set, set `out`. */ + settings.out = settings.out === null || settings.out === undefined ? true : settings.out; + + next(); + } +} diff --git a/node_modules/unified-engine/lib/file-set-pipeline/transform.js b/node_modules/unified-engine/lib/file-set-pipeline/transform.js new file mode 100644 index 00000000..48b61fd5 --- /dev/null +++ b/node_modules/unified-engine/lib/file-set-pipeline/transform.js @@ -0,0 +1,52 @@ +'use strict'; + +var FileSet = require('../file-set'); +var filePipeline = require('../file-pipeline'); + +module.exports = transform; + +/* Transform all files. */ +function transform(context, settings, next) { + var fileSet = new FileSet(); + + context.fileSet = fileSet; + + fileSet.on('add', add).on('done', next); + + if (context.files.length === 0) { + next(); + } else { + context.files.forEach(fileSet.add, fileSet); + } + + function add(file) { + filePipeline.run({ + configuration: context.configuration, + processor: settings.processor(), + cwd: settings.cwd, + extensions: settings.extensions, + pluginPrefix: settings.pluginPrefix, + treeIn: settings.treeIn, + treeOut: settings.treeOut, + inspect: settings.inspect, + color: settings.color, + out: settings.out, + output: settings.output, + streamOut: settings.streamOut, + alwaysStringify: settings.alwaysStringify + }, file, fileSet, done); + + function done(err) { + /* istanbul ignore next - doesn’t occur as all + * failures in `filePipeLine` are failed on each + * file. Still, just to ensure things work in + * the future, we add an extra check. */ + if (err) { + err = file.message(err); + err.fatal = true; + } + + fileSet.emit('one', file); + } + } +} diff --git a/node_modules/unified-engine/lib/file-set.js b/node_modules/unified-engine/lib/file-set.js new file mode 100644 index 00000000..7deb789e --- /dev/null +++ b/node_modules/unified-engine/lib/file-set.js @@ -0,0 +1,116 @@ +'use strict'; + +var events = require('events'); +var inherits = require('util').inherits; +var trough = require('trough'); +var vfile = require('to-vfile'); +var string = require('x-is-string'); + +module.exports = FileSet; + +/* FileSet constructor. */ +function FileSet() { + var self = this; + + self.files = []; + self.origins = []; + + self.expected = 0; + self.actual = 0; + + self.pipeline = trough(); + self.plugins = []; + + events.init.call(self); + + self.on('one', one.bind(self)); +} + +/* Events. */ +inherits(FileSet, events.EventEmitter); + +/* Expose methods. */ +FileSet.prototype.valueOf = valueOf; +FileSet.prototype.use = use; +FileSet.prototype.add = add; + +/* Create an array representation of `fileSet`. */ +function valueOf() { + return this.files; +} + +/* Attach middleware to the pipeline on `fileSet`. */ +function use(plugin) { + var self = this; + var pipeline = self.pipeline; + var duplicate = false; + + if (plugin && plugin.pluginId) { + duplicate = self.plugins.some(function (fn) { + return fn.pluginId === plugin.pluginId; + }); + } + + if (!duplicate && self.plugins.indexOf(plugin) !== -1) { + duplicate = true; + } + + if (!duplicate) { + self.plugins.push(plugin); + pipeline.use(plugin); + } + + return this; +} + +/* Add a file to be processed. + * + * Ignores duplicate files (based on the `filePath` at time + * of addition). + * + * Only runs `file-pipeline` on files which have not + * `failed` before addition. */ +function add(file) { + var self = this; + var origin; + + if (string(file)) { + file = vfile(file); + } + + /* Prevent files from being added multiple times. */ + origin = file.history[0]; + + if (self.origins.indexOf(origin) !== -1) { + return self; + } + + self.origins.push(origin); + + /* Add. */ + self.valueOf().push(file); + self.expected++; + + /* Force an asynchronous operation. + * This ensures that files which fall through + * the file pipeline immediately (e.g., when + * already fatally failed) still queue up + * correctly. */ + setImmediate(function () { + self.emit('add', file); + }); + + return self; +} + +/* Utility invoked when a single file has completed it's + * pipeline, triggering `done` when all files are complete. */ +function one() { + var self = this; + + self.actual++; + + if (self.actual >= self.expected) { + self.emit('done'); + } +} diff --git a/node_modules/unified-engine/lib/find-up.js b/node_modules/unified-engine/lib/find-up.js new file mode 100644 index 00000000..4db286d2 --- /dev/null +++ b/node_modules/unified-engine/lib/find-up.js @@ -0,0 +1,179 @@ +'use strict'; + +var fs = require('fs'); +var path = require('path'); +var fault = require('fault'); +var debug = require('debug')('unified-engine:find-up'); +var func = require('x-is-function'); +var object = require('is-object'); + +module.exports = FindUp; + +var read = fs.readFile; +var resolve = path.resolve; +var relative = path.relative; +var join = path.join; +var dirname = path.dirname; + +FindUp.prototype.load = load; + +function FindUp(options) { + var self = this; + var fp = options.filePath; + + self.cache = {}; + self.cwd = options.cwd; + self.detect = options.detect; + self.names = options.names; + self.create = options.create; + + if (fp) { + self.givenFilePath = resolve(options.cwd, fp); + } +} + +function load(filePath, callback) { + var self = this; + var cache = self.cache; + var givenFilePath = self.givenFilePath; + var givenFile = self.givenFile; + var names = self.names; + var create = self.create; + var cwd = self.cwd; + var parent; + + if (givenFilePath) { + if (givenFile) { + apply(callback, givenFile); + } else { + givenFile = [callback]; + self.givenFile = givenFile; + debug('Checking given file `%s`', givenFilePath); + read(givenFilePath, loadGiven); + } + + return; + } + + if (!self.detect) { + return callback(); + } + + filePath = resolve(cwd, filePath); + parent = dirname(filePath); + + if (parent in cache) { + apply(callback, cache[parent]); + } else { + cache[parent] = [callback]; + find(parent); + } + + function loadGiven(err, buf) { + var cbs = self.givenFile; + var result; + + if (err) { + result = fault('Cannot read given file `%s`\n%s', relative(cwd, givenFilePath), err.stack); + result.code = 'ENOENT'; + result.path = err.path; + result.syscall = err.syscall; + } else { + try { + result = create(buf, givenFilePath); + debug('Read given file `%s`', givenFilePath); + } catch (err) { + result = fault('Cannot parse given file `%s`\n%s', relative(cwd, givenFilePath), err.stack); + debug(err.message); + } + } + + givenFile = result; + self.givenFile = result; + applyAll(cbs, result); + } + + function find(directory) { + var index = -1; + var length = names.length; + + next(); + + function next() { + var parent; + + /* Try to read the next file. We don’t use `readdir` because on + * huge directories, that could be *very* slow. */ + if (++index < length) { + read(join(directory, names[index]), done); + } else { + parent = dirname(directory); + + if (directory === parent) { + debug('No files found for `%s`', filePath); + found(); + } else if (parent in cache) { + apply(found, cache[parent]); + } else { + cache[parent] = [found]; + find(parent); + } + } + } + + function done(err, buf) { + var name = names[index]; + var fp = join(directory, name); + var contents; + + /* istanbul ignore if - Hard to test. */ + if (err) { + if (err.code === 'ENOENT') { + return next(); + } + + err = fault('Cannot read file `%s`\n%s', relative(cwd, fp), err.message); + debug(err.message); + return found(err); + } + + try { + contents = create(buf, fp); + } catch (err) { + return found(fault('Cannot parse file `%s`\n%s', relative(cwd, fp), err.message)); + } + + /* istanbul ignore else - maybe used in the future. */ + if (contents) { + debug('Read file `%s`', fp); + found(null, contents); + } else { + next(); + } + } + + function found(err, result) { + var cbs = cache[directory]; + cache[directory] = err || result; + applyAll(cbs, err || result); + } + } + + function applyAll(cbs, result) { + var index = cbs.length; + + while (index--) { + apply(cbs[index], result); + } + } + + function apply(cb, result) { + if (object(result) && func(result[0])) { + result.push(cb); + } else if (result instanceof Error) { + cb(result); + } else { + cb(null, result); + } + } +} diff --git a/node_modules/unified-engine/lib/finder.js b/node_modules/unified-engine/lib/finder.js new file mode 100644 index 00000000..0650ffcb --- /dev/null +++ b/node_modules/unified-engine/lib/finder.js @@ -0,0 +1,251 @@ +'use strict'; + +var path = require('path'); +var fs = require('fs'); +var glob = require('glob'); +var vfile = require('to-vfile'); +var xtend = require('xtend'); +var hidden = require('is-hidden'); +var string = require('x-is-string'); + +var readdir = fs.readdir; +var stat = fs.stat; +var join = path.join; +var relative = path.relative; +var resolve = path.resolve; +var basename = path.basename; +var extname = path.extname; +var magic = glob.hasMagic; + +module.exports = find; + +/* Search `patterns`, a mix of globs, paths, and files. */ +function find(input, options, callback) { + expand(input, options, done); + + function done(err, result) { + /* istanbul ignore if - glob errors are unusual. + * other errors are on the vfile results. */ + if (err) { + callback(err); + } else { + callback(null, {oneFileMode: oneFileMode(result), files: result.output}); + } + } +} + +/* Expand the given glob patterns, search given and found + * directories, and map to vfiles. */ +function expand(input, options, next) { + var cwd = options.cwd; + var paths = []; + var actual = 0; + var expected = 0; + var failed; + + input.forEach(each); + + if (!expected) { + search(paths, options, done); + } + + function each(file) { + if (string(file)) { + if (magic(file)) { + expected++; + glob(file, {cwd: cwd}, one); + } else { + /* `relative` to make the paths canonical. */ + file = relative(cwd, resolve(cwd, file)) || '.'; + paths.push(file); + } + } else { + file.cwd = cwd; + file.path = relative(cwd, file.path); + file.history = [file.path]; + paths.push(file); + } + } + + function one(err, files) { + /* istanbul ignore if - glob errors are unusual. */ + if (failed) { + return; + } + + /* istanbul ignore if - glob errors are unusual. */ + if (err) { + failed = true; + done(err); + } else { + actual++; + paths = paths.concat(files); + + if (actual === expected) { + search(paths, options, done); + } + } + } + + function done(err, files) { + /* istanbul ignore if - `search` currently does not give errors. */ + if (err) { + next(err); + } else { + next(null, {input: paths, output: files}); + } + } +} + +/* Search `paths`. */ +function search(input, options, next) { + var cwd = options.cwd; + var silent = options.silentlyIgnore; + var nested = options.nested; + var extensions = options.extensions; + var files = []; + var expected = 0; + var actual = 0; + + input.forEach(each); + + if (!expected) { + next(null, files); + } + + return each; + + function each(file) { + var part = base(file); + + if (nested && (hidden(part) || part === 'node_modules')) { + return; + } + + expected++; + + statAndIgnore(file, options, handle); + + function handle(err, result) { + var ignored = result && result.ignored; + var dir = result && result.stats && result.stats.isDirectory(); + + if (ignored && (nested || silent)) { + return one(null, []); + } + + if (!ignored && dir) { + return readdir(resolve(cwd, filePath(file)), directory); + } + + if (nested && !dir && extensions.length !== 0 && extensions.indexOf(extname(file)) === -1) { + return one(null, []); + } + + file = vfile(file); + file.cwd = cwd; + + if (ignored) { + try { + file.fail('Cannot process specified file: it’s ignored'); + } catch (err) {} + } + + if (err && err.code === 'ENOENT') { + try { + file.fail(err.syscall === 'stat' ? 'No such file or directory' : err); + } catch (err) {} + } + + one(null, [file]); + } + + function directory(err, basenames) { + var file; + + /* istanbul ignore if - Should not happen often: the directory + * is `stat`ed first, which was ok, but reading it is not. */ + if (err) { + file = vfile(filePath(file)); + file.cwd = cwd; + + try { + file.fail('Cannot read directory'); + } catch (err) {} + + one(null, [file]); + } else { + search(basenames.map(concat), xtend(options, {nested: true}), one); + } + } + + /* Error is never given. Always given `results`. */ + function one(_, results) { + /* istanbul ignore else - always given. */ + if (results) { + files = files.concat(results); + } + + actual++; + + if (actual === expected) { + next(null, files); + } + } + + function concat(value) { + return join(filePath(file), value); + } + } +} + +function statAndIgnore(file, options, callback) { + var ignore = options.ignore; + var fp = resolve(options.cwd, filePath(file)); + var expected = 1; + var actual = 0; + var stats; + var ignored; + + if (!file.contents) { + expected++; + stat(fp, handleStat); + } + + ignore.check(fp, handleIgnore); + + function handleStat(err, value) { + stats = value; + one(err); + } + + function handleIgnore(err, value) { + ignored = value; + one(err); + } + + function one(err) { + actual++; + + if (err) { + callback(err); + actual = -1; + } else if (actual === expected) { + callback(null, {stats: stats, ignored: ignored}); + } + } +} + +function base(file) { + return string(file) ? basename(file) : file.basename; +} + +function filePath(file) { + return string(file) ? file : file.path; +} + +function oneFileMode(result) { + return result.output.length === 1 && + result.input.length === 1 && + result.output[0].path === result.input[0]; +} diff --git a/node_modules/unified-engine/lib/ignore.js b/node_modules/unified-engine/lib/ignore.js new file mode 100644 index 00000000..b9f91614 --- /dev/null +++ b/node_modules/unified-engine/lib/ignore.js @@ -0,0 +1,50 @@ +'use strict'; + +var path = require('path'); +var gitignore = require('ignore'); +var FindUp = require('./find-up'); + +module.exports = Ignore; + +Ignore.prototype.check = check; + +var dirname = path.dirname; +var relative = path.relative; +var resolve = path.resolve; + +function Ignore(options) { + this.cwd = options.cwd; + + this.findUp = new FindUp({ + filePath: options.ignorePath, + cwd: options.cwd, + detect: options.detectIgnore, + names: options.ignoreName ? [options.ignoreName] : [], + create: create + }); +} + +function check(filePath, callback) { + var self = this; + + self.findUp.load(filePath, done); + + function done(err, ignore) { + var normal; + + if (err) { + callback(err); + } else if (ignore) { + normal = relative(ignore.filePath, resolve(self.cwd, filePath)); + callback(null, normal ? ignore.ignores(normal) : false); + } else { + callback(null, false); + } + } +} + +function create(buf, filePath) { + var ignore = gitignore().add(String(buf)); + ignore.filePath = dirname(filePath); + return ignore; +} diff --git a/node_modules/unified-engine/lib/index.js b/node_modules/unified-engine/lib/index.js new file mode 100644 index 00000000..87715daf --- /dev/null +++ b/node_modules/unified-engine/lib/index.js @@ -0,0 +1,141 @@ +'use strict'; + +var PassThrough = require('stream').PassThrough; +var statistics = require('vfile-statistics'); +var fileSetPipeline = require('./file-set-pipeline'); + +module.exports = run; + +/* Run the file set pipeline once. + * `callback` is invoked with a fatal error, + * or with a status code (`0` on success, `1` on failure). */ +function run(options, callback) { + var settings = {}; + var stdin = new PassThrough(); + var tree; + var detectConfig; + var hasConfig; + var detectIgnore; + var hasIgnore; + + try { + stdin = process.stdin; + } catch (err) { + /* Obscure bug in Node (seen on windows): + * - https://github.com/nodejs/node/blob/f856234/lib/internal/ + * process/stdio.js#L82; + * - https://github.com/AtomLinter/linter-markdown/pull/85. + */ + } + + if (!callback) { + throw new Error('Missing `callback`'); + } + + if (!options || !options.processor) { + return next(new Error('Missing `processor`')); + } + + /* Processor. */ + settings.processor = options.processor; + + /* Path to run as. */ + settings.cwd = options.cwd || process.cwd(); + + /* Input. */ + settings.files = options.files || []; + settings.extensions = (options.extensions || []).map(function (extension) { + return extension.charAt(0) === '.' ? extension : '.' + extension; + }); + + settings.filePath = options.filePath || null; + settings.streamIn = options.streamIn || stdin; + + /* Output. */ + settings.streamOut = options.streamOut || process.stdout; + settings.streamError = options.streamError || process.stderr; + settings.alwaysStringify = options.alwaysStringify; + settings.output = options.output; + settings.out = options.out; + + /* Null overwrites config settings, `undefined` doesn’t. */ + if (settings.output === null || settings.output === undefined) { + settings.output = undefined; + } + + if (settings.output && settings.out) { + return next(new Error('Cannot accept both `output` and `out`')); + } + + /* Process phase management. */ + tree = options.tree || false; + + settings.treeIn = options.treeIn; + settings.treeOut = options.treeOut; + settings.inspect = options.inspect; + + if (settings.treeIn === null || settings.treeIn === undefined) { + settings.treeIn = tree; + } + + if (settings.treeOut === null || settings.treeOut === undefined) { + settings.treeOut = tree; + } + + /* Configuration. */ + detectConfig = options.detectConfig; + hasConfig = Boolean(options.rcName || options.packageField); + + if (detectConfig && !hasConfig) { + return next(new Error( + 'Missing `rcName` or `packageField` with `detectConfig`' + )); + } + + settings.detectConfig = detectConfig === null || detectConfig === undefined ? hasConfig : detectConfig; + settings.rcName = options.rcName || null; + settings.rcPath = options.rcPath || null; + settings.packageField = options.packageField || null; + settings.settings = options.settings || {}; + settings.configTransform = options.configTransform; + settings.defaultConfig = options.defaultConfig; + + /* Ignore. */ + detectIgnore = options.detectIgnore; + hasIgnore = Boolean(options.ignoreName); + + settings.detectIgnore = detectIgnore === null || detectIgnore === undefined ? hasIgnore : detectIgnore; + settings.ignoreName = options.ignoreName || null; + settings.ignorePath = options.ignorePath || null; + settings.silentlyIgnore = Boolean(options.silentlyIgnore); + + if (detectIgnore && !hasIgnore) { + return next(new Error('Missing `ignoreName` with `detectIgnore`')); + } + + /* Plug-ins. */ + settings.pluginPrefix = options.pluginPrefix || null; + settings.plugins = options.plugins || {}; + + /* Reporting. */ + settings.reporter = options.reporter || null; + settings.reporterOptions = options.reporterOptions || null; + settings.color = options.color || false; + settings.silent = options.silent || false; + settings.quiet = options.quiet || false; + settings.frail = options.frail || false; + + /* Process. */ + fileSetPipeline.run({files: options.files || []}, settings, next); + + function next(err, context) { + var stats = statistics((context || {}).files); + var failed = Boolean(settings.frail ? stats.fatal || stats.warn : stats.fatal); + + if (err) { + callback(err); + } else { + callback(null, failed ? 1 : 0, context); + } + } +} diff --git a/node_modules/unified-engine/node_modules/debug/CHANGELOG.md b/node_modules/unified-engine/node_modules/debug/CHANGELOG.md new file mode 100644 index 00000000..820d21e3 --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/CHANGELOG.md @@ -0,0 +1,395 @@ + +3.1.0 / 2017-09-26 +================== + + * Add `DEBUG_HIDE_DATE` env var (#486) + * Remove ReDoS regexp in %o formatter (#504) + * Remove "component" from package.json + * Remove `component.json` + * Ignore package-lock.json + * Examples: fix colors printout + * Fix: browser detection + * Fix: spelling mistake (#496, @EdwardBetts) + +3.0.1 / 2017-08-24 +================== + + * Fix: Disable colors in Edge and Internet Explorer (#489) + +3.0.0 / 2017-08-08 +================== + + * Breaking: Remove DEBUG_FD (#406) + * Breaking: Use `Date#toISOString()` instead to `Date#toUTCString()` when output is not a TTY (#418) + * Breaking: Make millisecond timer namespace specific and allow 'always enabled' output (#408) + * Addition: document `enabled` flag (#465) + * Addition: add 256 colors mode (#481) + * Addition: `enabled()` updates existing debug instances, add `destroy()` function (#440) + * Update: component: update "ms" to v2.0.0 + * Update: separate the Node and Browser tests in Travis-CI + * Update: refactor Readme, fixed documentation, added "Namespace Colors" section, redid screenshots + * Update: separate Node.js and web browser examples for organization + * Update: update "browserify" to v14.4.0 + * Fix: fix Readme typo (#473) + +2.6.9 / 2017-09-22 +================== + + * remove ReDoS regexp in %o formatter (#504) + +2.6.8 / 2017-05-18 +================== + + * Fix: Check for undefined on browser globals (#462, @marbemac) + +2.6.7 / 2017-05-16 +================== + + * Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom) + * Fix: Inline extend function in node implementation (#452, @dougwilson) + * Docs: Fix typo (#455, @msasad) + +2.6.5 / 2017-04-27 +================== + + * Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek) + * Misc: clean up browser reference checks (#447, @thebigredgeek) + * Misc: add npm-debug.log to .gitignore (@thebigredgeek) + + +2.6.4 / 2017-04-20 +================== + + * Fix: bug that would occur if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo) + * Chore: ignore bower.json in npm installations. (#437, @joaovieira) + * Misc: update "ms" to v0.7.3 (@tootallnate) + +2.6.3 / 2017-03-13 +================== + + * Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts) + * Docs: Changelog fix (@thebigredgeek) + +2.6.2 / 2017-03-10 +================== + + * Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin) + * Docs: Add backers and sponsors from Open Collective (#422, @piamancini) + * Docs: Add Slackin invite badge (@tootallnate) + +2.6.1 / 2017-02-10 +================== + + * Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error + * Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0) + * Fix: IE8 "Expected identifier" error (#414, @vgoma) + * Fix: Namespaces would not disable once enabled (#409, @musikov) + +2.6.0 / 2016-12-28 +================== + + * Fix: added better null pointer checks for browser useColors (@thebigredgeek) + * Improvement: removed explicit `window.debug` export (#404, @tootallnate) + * Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate) + +2.5.2 / 2016-12-25 +================== + + * Fix: reference error on window within webworkers (#393, @KlausTrainer) + * Docs: fixed README typo (#391, @lurch) + * Docs: added notice about v3 api discussion (@thebigredgeek) + +2.5.1 / 2016-12-20 +================== + + * Fix: babel-core compatibility + +2.5.0 / 2016-12-20 +================== + + * Fix: wrong reference in bower file (@thebigredgeek) + * Fix: webworker compatibility (@thebigredgeek) + * Fix: output formatting issue (#388, @kribblo) + * Fix: babel-loader compatibility (#383, @escwald) + * Misc: removed built asset from repo and publications (@thebigredgeek) + * Misc: moved source files to /src (#378, @yamikuronue) + * Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue) + * Test: coveralls integration (#378, @yamikuronue) + * Docs: simplified language in the opening paragraph (#373, @yamikuronue) + +2.4.5 / 2016-12-17 +================== + + * Fix: `navigator` undefined in Rhino (#376, @jochenberger) + * Fix: custom log function (#379, @hsiliev) + * Improvement: bit of cleanup + linting fixes (@thebigredgeek) + * Improvement: rm non-maintainted `dist/` dir (#375, @freewil) + * Docs: simplified language in the opening paragraph. (#373, @yamikuronue) + +2.4.4 / 2016-12-14 +================== + + * Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts) + +2.4.3 / 2016-12-14 +================== + + * Fix: navigation.userAgent error for react native (#364, @escwald) + +2.4.2 / 2016-12-14 +================== + + * Fix: browser colors (#367, @tootallnate) + * Misc: travis ci integration (@thebigredgeek) + * Misc: added linting and testing boilerplate with sanity check (@thebigredgeek) + +2.4.1 / 2016-12-13 +================== + + * Fix: typo that broke the package (#356) + +2.4.0 / 2016-12-13 +================== + + * Fix: bower.json references unbuilt src entry point (#342, @justmatt) + * Fix: revert "handle regex special characters" (@tootallnate) + * Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate) + * Feature: %O`(big O) pretty-prints objects (#322, @tootallnate) + * Improvement: allow colors in workers (#335, @botverse) + * Improvement: use same color for same namespace. (#338, @lchenay) + +2.3.3 / 2016-11-09 +================== + + * Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne) + * Fix: Returning `localStorage` saved values (#331, Levi Thomason) + * Improvement: Don't create an empty object when no `process` (Nathan Rajlich) + +2.3.2 / 2016-11-09 +================== + + * Fix: be super-safe in index.js as well (@TooTallNate) + * Fix: should check whether process exists (Tom Newby) + +2.3.1 / 2016-11-09 +================== + + * Fix: Added electron compatibility (#324, @paulcbetts) + * Improvement: Added performance optimizations (@tootallnate) + * Readme: Corrected PowerShell environment variable example (#252, @gimre) + * Misc: Removed yarn lock file from source control (#321, @fengmk2) + +2.3.0 / 2016-11-07 +================== + + * Fix: Consistent placement of ms diff at end of output (#215, @gorangajic) + * Fix: Escaping of regex special characters in namespace strings (#250, @zacronos) + * Fix: Fixed bug causing crash on react-native (#282, @vkarpov15) + * Feature: Enabled ES6+ compatible import via default export (#212 @bucaran) + * Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom) + * Package: Update "ms" to 0.7.2 (#315, @DevSide) + * Package: removed superfluous version property from bower.json (#207 @kkirsche) + * Readme: fix USE_COLORS to DEBUG_COLORS + * Readme: Doc fixes for format string sugar (#269, @mlucool) + * Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0) + * Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable) + * Readme: better docs for browser support (#224, @matthewmueller) + * Tooling: Added yarn integration for development (#317, @thebigredgeek) + * Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek) + * Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman) + * Misc: Updated contributors (@thebigredgeek) + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/unified-engine/node_modules/debug/LICENSE b/node_modules/unified-engine/node_modules/debug/LICENSE new file mode 100644 index 00000000..658c933d --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/LICENSE @@ -0,0 +1,19 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/unified-engine/node_modules/debug/README.md b/node_modules/unified-engine/node_modules/debug/README.md new file mode 100644 index 00000000..0ee7634d --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/README.md @@ -0,0 +1,437 @@ +# debug +[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> + +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/unified-engine/node_modules/debug/dist/debug.js b/node_modules/unified-engine/node_modules/debug/dist/debug.js new file mode 100644 index 00000000..f271e01c --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/dist/debug.js @@ -0,0 +1,886 @@ +"use strict"; + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +(function (f) { + if ((typeof exports === "undefined" ? "undefined" : _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.debug = f(); + } +})(function () { + var define, module, exports; + return function () { + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = "function" == typeof require && require; + if (!f && c) return c(i, !0); + if (u) return u(i, !0); + var a = new Error("Cannot find module '" + i + "'"); + throw a.code = "MODULE_NOT_FOUND", a; + } + + var p = n[i] = { + exports: {} + }; + e[i][0].call(p.exports, function (r) { + var n = e[i][1][r]; + return o(n || r); + }, p, p.exports, r, e, n, t); + } + + return n[i].exports; + } + + for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { + o(t[i]); + } + + return o; + } + + return r; + }()({ + 1: [function (require, module, exports) { + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + module.exports = function (val, options) { + options = options || {}; + + var type = _typeof(val); + + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? fmtLong(val) : fmtShort(val); + } + + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + + function parse(str) { + str = String(str); + + if (str.length > 100) { + return; + } + + var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str); + + if (!match) { + return; + } + + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + + case 'weeks': + case 'week': + case 'w': + return n * w; + + case 'days': + case 'day': + case 'd': + return n * d; + + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + + default: + return undefined; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + + return ms + ' ms'; + } + /** + * Pluralization helper. + */ + + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + }, {}], + 2: [function (require, 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.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { + return []; + }; + + 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; + }; + }, {}], + 3: [function (require, module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + // Disabled? + if (!debug.enabled) { + return; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @api public + */ + + + function disable() { + createDebug.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; + } + + module.exports = setup; + }, { + "ms": 1 + }], + 4: [function (require, module, exports) { + (function (process) { + /* eslint-env browser */ + + /** + * This is the web browser implementation of `debug()`. + */ + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + /** + * Colors. + */ + + exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + // eslint-disable-next-line complexity + + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + + function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + + function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = require('./common')(exports); + var formatters = module.exports.formatters; + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + }).call(this, require('_process')); + }, { + "./common": 3, + "_process": 2 + }] + }, {}, [4])(4); +}); + diff --git a/node_modules/unified-engine/node_modules/debug/node.js b/node_modules/unified-engine/node_modules/debug/node.js new file mode 100644 index 00000000..7fc36fe6 --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/node.js @@ -0,0 +1 @@ +module.exports = require('./src/node'); diff --git a/node_modules/unified-engine/node_modules/debug/package.json b/node_modules/unified-engine/node_modules/debug/package.json new file mode 100644 index 00000000..4ef34198 --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/package.json @@ -0,0 +1,90 @@ +{ + "_from": "debug@^3.1.0", + "_id": "debug@3.2.6", + "_inBundle": false, + "_integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "_location": "/unified-engine/debug", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "debug@^3.1.0", + "name": "debug", + "escapedName": "debug", + "rawSpec": "^3.1.0", + "saveSpec": null, + "fetchSpec": "^3.1.0" + }, + "_requiredBy": [ + "/unified-engine" + ], + "_resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "_shasum": "e83d17de16d8a7efb7717edbe5fb10135eee629b", + "_spec": "debug@^3.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-engine", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "browser": "./src/browser.js", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + }, + { + "name": "Andrew Rhyne", + "email": "rhyneandrew@gmail.com" + } + ], + "dependencies": { + "ms": "^2.1.1" + }, + "deprecated": false, + "description": "small debugging utility", + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "browserify": "14.4.0", + "chai": "^3.5.0", + "concurrently": "^3.1.0", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "rimraf": "^2.5.4", + "xo": "^0.23.0" + }, + "files": [ + "src", + "node.js", + "dist/debug.js", + "LICENSE", + "README.md" + ], + "homepage": "https://github.com/visionmedia/debug#readme", + "keywords": [ + "debug", + "log", + "debugger" + ], + "license": "MIT", + "main": "./src/index.js", + "name": "debug", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "unpkg": "./dist/debug.js", + "version": "3.2.6" +} diff --git a/node_modules/unified-engine/node_modules/debug/src/browser.js b/node_modules/unified-engine/node_modules/debug/src/browser.js new file mode 100644 index 00000000..c924b0ac --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/src/browser.js @@ -0,0 +1,180 @@ +"use strict"; + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +/** + * Colors. + */ + +exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33']; +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ +// eslint-disable-next-line complexity + +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } // Internet Explorer and Edge do not support colors. + + + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + + + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); +} +/** + * Colorize log arguments if enabled. + * + * @api public + */ + + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + var c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + + var index = 0; + var lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, function (match) { + if (match === '%%') { + return; + } + + index++; + + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + args.splice(lastC, 0, c); +} +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + +function log() { + var _console; + + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } +} +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + +function load() { + var r; + + try { + r = exports.storage.getItem('debug'); + } catch (error) {} // Swallow + // XXX (@Qix-) should we be logging these? + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + + + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) {// Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + diff --git a/node_modules/unified-engine/node_modules/debug/src/common.js b/node_modules/unified-engine/node_modules/debug/src/common.js new file mode 100644 index 00000000..e0de3fb5 --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/src/common.js @@ -0,0 +1,249 @@ +"use strict"; + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + Object.keys(env).forEach(function (key) { + createDebug[key] = env[key]; + }); + /** + * Active `debug` instances. + */ + + createDebug.instances = []; + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + + createDebug.formatters = {}; + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + + function selectColor(namespace) { + var hash = 0; + + for (var i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + + createDebug.selectColor = selectColor; + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function createDebug(namespace) { + var prevTime; + + function debug() { + // Disabled? + if (!debug.enabled) { + return; + } + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var self = debug; // Set `diff` timestamp + + var curr = Number(new Date()); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } // Apply any `formatters` transformations + + + var index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + + index++; + var formatter = createDebug.formatters[format]; + + if (typeof formatter === 'function') { + var val = args[index]; + match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` + + args.splice(index, 1); + index--; + } + + return match; + }); // Apply env-specific formatting (colors, etc.) + + createDebug.formatArgs.call(self, args); + var logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + // env-specific initialization logic for debug instances + + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + return debug; + } + + function destroy() { + var index = createDebug.instances.indexOf(this); + + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + + return false; + } + + function extend(namespace, delimiter) { + return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + } + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.names = []; + createDebug.skips = []; + var i; + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + var len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + var instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + /** + * Disable debug output. + * + * @api public + */ + + + function disable() { + createDebug.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + var i; + var len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + + return val; + } + + createDebug.enable(createDebug.load()); + return createDebug; +} + +module.exports = setup; + diff --git a/node_modules/unified-engine/node_modules/debug/src/index.js b/node_modules/unified-engine/node_modules/debug/src/index.js new file mode 100644 index 00000000..02173159 --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/src/index.js @@ -0,0 +1,12 @@ +"use strict"; + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} + diff --git a/node_modules/unified-engine/node_modules/debug/src/node.js b/node_modules/unified-engine/node_modules/debug/src/node.js new file mode 100644 index 00000000..dbbb5f10 --- /dev/null +++ b/node_modules/unified-engine/node_modules/debug/src/node.js @@ -0,0 +1,174 @@ +"use strict"; + +/** + * Module dependencies. + */ +var tty = require('tty'); + +var util = require('util'); +/** + * This is the Node.js implementation of `debug()`. + */ + + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + var supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221]; + } +} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be. + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + + +exports.inspectOpts = Object.keys(process.env).filter(function (key) { + return /^debug_/i.test(key); +}).reduce(function (obj, key) { + // Camel-case + var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) { + return k.toUpperCase(); + }); // Coerce string value into JS value + + var val = process.env[key]; + + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); +} +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + + +function formatArgs(args) { + var name = this.namespace, + useColors = this.useColors; + + if (useColors) { + var c = this.color; + var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c); + var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m"); + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m"); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + + return new Date().toISOString() + ' '; +} +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + + +function log() { + return process.stderr.write(util.format.apply(util, arguments) + '\n'); +} +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + +function load() { + return process.env.DEBUG; +} +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + + +function init(debug) { + debug.inspectOpts = {}; + var keys = Object.keys(exports.inspectOpts); + + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); +var formatters = module.exports.formatters; +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' '); +}; +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + diff --git a/node_modules/unified-engine/node_modules/ms/index.js b/node_modules/unified-engine/node_modules/ms/index.js new file mode 100644 index 00000000..c4498bcc --- /dev/null +++ b/node_modules/unified-engine/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/unified-engine/node_modules/ms/license.md b/node_modules/unified-engine/node_modules/ms/license.md new file mode 100644 index 00000000..69b61253 --- /dev/null +++ b/node_modules/unified-engine/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +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/unified-engine/node_modules/ms/package.json b/node_modules/unified-engine/node_modules/ms/package.json new file mode 100644 index 00000000..e7ecd1aa --- /dev/null +++ b/node_modules/unified-engine/node_modules/ms/package.json @@ -0,0 +1,69 @@ +{ + "_from": "ms@^2.1.1", + "_id": "ms@2.1.2", + "_inBundle": false, + "_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "_location": "/unified-engine/ms", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ms@^2.1.1", + "name": "ms", + "escapedName": "ms", + "rawSpec": "^2.1.1", + "saveSpec": null, + "fetchSpec": "^2.1.1" + }, + "_requiredBy": [ + "/unified-engine/debug" + ], + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009", + "_spec": "ms@^2.1.1", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-engine/node_modules/debug", + "bugs": { + "url": "https://github.com/zeit/ms/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Tiny millisecond conversion utility", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/zeit/ms#readme", + "license": "MIT", + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "main": "./index", + "name": "ms", + "repository": { + "type": "git", + "url": "git+https://github.com/zeit/ms.git" + }, + "scripts": { + "lint": "eslint lib/* bin/*", + "precommit": "lint-staged", + "test": "mocha tests.js" + }, + "version": "2.1.2" +} diff --git a/node_modules/unified-engine/node_modules/ms/readme.md b/node_modules/unified-engine/node_modules/ms/readme.md new file mode 100644 index 00000000..9a1996b1 --- /dev/null +++ b/node_modules/unified-engine/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/unified-engine/package.json b/node_modules/unified-engine/package.json new file mode 100644 index 00000000..3a9e614c --- /dev/null +++ b/node_modules/unified-engine/package.json @@ -0,0 +1,121 @@ +{ + "_from": "unified-engine@^5.1.0", + "_id": "unified-engine@5.1.0", + "_inBundle": false, + "_integrity": "sha512-N7b7HG6doQUtkWr+kH35tfUhfc9QiYeiZGG6TcZlexSURf4xRUpYKBbc2f67qJF5oPmn6mMkImkdhr31Q6saoA==", + "_location": "/unified-engine", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unified-engine@^5.1.0", + "name": "unified-engine", + "escapedName": "unified-engine", + "rawSpec": "^5.1.0", + "saveSpec": null, + "fetchSpec": "^5.1.0" + }, + "_requiredBy": [ + "/unified-args" + ], + "_resolved": "https://registry.npmjs.org/unified-engine/-/unified-engine-5.1.0.tgz", + "_shasum": "30db83bcc76c821f773bb5a8a491aa0e2471e3d1", + "_spec": "unified-engine@^5.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-args", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/unifiedjs/unified-engine/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "concat-stream": "^1.5.1", + "debug": "^3.1.0", + "fault": "^1.0.0", + "fn-name": "^2.0.1", + "glob": "^7.0.3", + "ignore": "^3.2.0", + "is-empty": "^1.0.0", + "is-hidden": "^1.0.1", + "is-object": "^1.0.1", + "js-yaml": "^3.6.1", + "load-plugin": "^2.0.0", + "parse-json": "^4.0.0", + "to-vfile": "^2.0.0", + "trough": "^1.0.0", + "unist-util-inspect": "^4.1.2", + "vfile-reporter": "^4.0.0", + "vfile-statistics": "^1.1.0", + "x-is-function": "^1.0.4", + "x-is-string": "^0.1.0", + "xtend": "^4.0.1" + }, + "deprecated": false, + "description": "Engine to process multiple files with unified", + "devDependencies": { + "nyc": "^11.0.0", + "remark-cli": "^4.0.0", + "remark-preset-wooorm": "^4.0.0", + "strip-ansi": "^4.0.0", + "tape": "^4.4.0", + "unified": "^6.0.0", + "vfile-reporter-json": "^1.0.1", + "vfile-reporter-pretty": "^1.0.1", + "xo": "^0.18.1" + }, + "files": [ + "lib/" + ], + "homepage": "https://github.com/unifiedjs/unified-engine#readme", + "keywords": [ + "unified", + "processor", + "engine" + ], + "license": "MIT", + "main": "lib/index.js", + "name": "unified-engine", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/unifiedjs/unified-engine.git" + }, + "scripts": { + "build": "npm run build-md", + "build-md": "remark . -qfo", + "lint": "xo", + "test": "npm run build && npm run lint && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test/index.js" + }, + "version": "5.1.0", + "xo": { + "space": true, + "esnext": false, + "rules": { + "complexity": "off", + "guard-for-in": "off", + "max-depth": "off" + } + } +} diff --git a/node_modules/unified-engine/readme.md b/node_modules/unified-engine/readme.md new file mode 100644 index 00000000..97944b0d --- /dev/null +++ b/node_modules/unified-engine/readme.md @@ -0,0 +1,287 @@ +# unified-engine [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] + +Engine to process multiple files with [**unified**][unified], allowing users +to [configure][] from the file-system. + +## Projects + +The following projects wrap the engine: + +* [`unified-args`][args] — Create CLIs for processors +* [`unified-engine-gulp`][gulp] — Create Gulp plug-ins +* [`unified-engine-atom`][atom] — Create Atom Linters for processors + +## Installation + +[npm][]: + +```bash +npm install unified-engine +``` + +## Usage + +The following example processes all files in the current directory with a +markdown extension with [**remark**][remark], allows [configuration][configure] +from `.remarkrc` and `package.json` files, ignoring files from `.remarkignore` +files, and more. + +```js +var engine = require('unified-engine'); +var remark = require('remark'); + +engine({ + processor: remark, + files: ['.'], + extensions: ['md', 'markdown', 'mkd', 'mkdn', 'mkdown'], + pluginPrefix: 'remark', + rcName: '.remarkrc', + packageField: 'remarkConfig', + ignoreName: '.remarkignore', + color: true +}, function (err) { + if (err) throw err; +}); +``` + +## Table of Contents + +* [API](#api) + * [engine(options, callback)](#engineoptions-callback) +* [Plug-ins](#plug-ins) +* [Configuration](#configuration) +* [Ignoring](#ignoring) +* [Contribute](#contribute) +* [License](#license) + +## API + +### `engine(options, callback)` + +Process files according to `options` and invoke [`callback`][callback] when +done. + +###### [`options`][options] + +* [`processor`][processor] ([`Processor`][unified-processor]) + — Unified processor to transform files +* [`cwd`][cwd] (`string`, default: `process.cwd()`) + — Directory to search files in, load plug-ins from, and more +* [`files`][files] (`Array.`, optional) + — Paths or globs to files and directories, or virtual files, to process +* [`extensions`][extensions] (`Array.`, optional) + — If `files` matches directories, include files with `extensions` +* [`streamIn`][stream-in] (`ReadableStream`, default: `process.stdin`) + — Stream to read from if no files are found or given +* [`filePath`][file-path] (`string`, optional) + — File path to process the given file on `streamIn` as +* [`streamOut`][stream-out] (`WritableStream`, default: `process.stdout`) + — Stream to write processed files to +* [`streamError`][stream-error] (`WritableStream`, default: `process.stderr`) + — Stream to write the report (if any) to +* [`out`][out] (`boolean`, default: depends) + — Whether to write the processed file to `streamOut` +* [`output`][output] (`boolean` or `string`, default: `false`) + — Whether to write successfully processed files, and where to +* [`alwaysStringify`][always-stringify] (`boolean`, default: `false`) + — Whether to always compile successfully processed files +* [`tree`][tree] (`boolean`, default: `false`) + — Whether to treat both input and output as a syntax tree +* [`treeIn`][tree-in] (`boolean`, default: `tree`) + — Whether to treat input as a syntax tree +* [`treeOut`][tree-out] (`boolean`, default: `tree`) + — Whether to treat output as a syntax tree +* [`inspect`][inspect] (`boolean`, default: `false`) + — Whether to output a formatted syntax tree +* [`rcName`][rc-name] (`string`, optional) + — Name of configuration files to load +* [`packageField`][package-field] (`string`, optional) + — Property at which configuration can be found in `package.json` files +* [`detectConfig`][detect-config] (`boolean`, default: whether `rcName` or + `packageField` is given) + — Whether to search for configuration files +* [`rcPath`][rc-path] (`string`, optional) + — File-path to a configuration file to load +* [`settings`][settings] (`Object`, optional) + — Configuration for the parser and compiler of the processor +* [`ignoreName`][ignore-name] (`string`, optional) + — Name of ignore files to load +* [`detectIgnore`][detect-ignore] (`boolean`, default: whether `ignoreName` + is given) + — Whether to search for ignore files +* [`ignorePath`][ignore-path] (`string`, optional) + — File-path to an ignore file to load +* [`silentlyIgnore`][silently-ignore] (`boolean`, default: `false`) + — Skip given files if they are ignored +* [`plugins`][plugins] (`Array|Object`, optional) + — Plug-ins to use +* [`pluginPrefix`][plugin-prefix] (`string`, optional) + — Optional prefix to use when searching for plug-ins +* [`configTransform`][config-transform] (`Function`, optional) + — Transform config files from a different schema +* [`reporter`][reporter] (`string` or `function`, default: + `require('vfile-reporter')`) + — Reporter to use +* [`reporterOptions`][reporteroptions] (`Object?`, optional) + — Config to pass to the used reporter +* [`color`][color] (`boolean`, default: `false`) + — Whether to report with ANSI colour sequences +* [`silent`][silent] (`boolean`, default: `false`) + — Report only fatal errors +* [`quiet`][quiet] (`boolean`, default: `silent`) + — Do not report successful files +* [`frail`][frail] (`boolean`, default: `false`) + — Call back with an unsuccessful (`1`) code on warnings as well as errors + +#### `function callback(err[, code, context])` + +Callback invoked when processing according to `options` is complete. +Invoked with either a fatal error if processing went horribly wrong +(probably due to incorrect configuration), or a status code and the +processing context. + +###### Parameters + +* `err` (`Error`) — Fatal error +* `code` (`number`) — Either `0` if successful, or `1` if + unsuccessful. The latter occurs if [fatal][] errors + happen when processing individual files, or if [`frail`][frail] + is set and warnings occur +* `context` (`Object`) — Processing context, containing internally + used information and a `files` array with the processed files + +## Plug-ins + +[`doc/plug-ins.md`][plug-ins] describes in detail how plug-ins +can add more files to be processed and handle all transformed files. + +## Configuration + +[`doc/configure.md`][configure] describes in detail how configuration +files work. + +## Ignoring + +[`doc/ignore.md`][ignore] describes in detail how ignore files work. + +## Contribute + +See [`contribute.md` in `unifiedjs/unified`][contribute] for ways to get +started. + +This organisation has a [Code of Conduct][coc]. By interacting with this +repository, organisation, or community you agree to abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[travis-badge]: https://img.shields.io/travis/unifiedjs/unified-engine.svg + +[travis]: https://travis-ci.org/unifiedjs/unified-engine + +[codecov-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified-engine.svg + +[codecov]: https://codecov.io/github/unifiedjs/unified-engine + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[unified]: https://github.com/unifiedjs/unified + +[unified-processor]: https://github.com/unifiedjs/unified#processor + +[remark]: https://github.com/remarkjs/remark + +[fatal]: https://github.com/vfile/vfile#vfilefailreason-position-ruleid + +[callback]: #function-callbackerr-code-context + +[options]: doc/options.md#options + +[processor]: doc/options.md#optionsprocessor + +[cwd]: doc/options.md#optionscwd + +[extensions]: doc/options.md#optionsextensions + +[stream-in]: doc/options.md#optionsstreamin + +[file-path]: doc/options.md#optionsfilepath + +[stream-out]: doc/options.md#optionsstreamout + +[stream-error]: doc/options.md#optionsstreamerror + +[out]: doc/options.md#optionsout + +[output]: doc/options.md#optionsoutput + +[always-stringify]: doc/options.md#optionsalwaysstringify + +[tree]: doc/options.md#optionstree + +[tree-in]: doc/options.md#optionstreein + +[tree-out]: doc/options.md#optionstreeout + +[inspect]: doc/options.md#optionsinspect + +[detect-config]: doc/options.md#optionsdetectconfig + +[rc-name]: doc/options.md#optionsrcname + +[package-field]: doc/options.md#optionspackagefield + +[rc-path]: doc/options.md#optionsrcpath + +[settings]: doc/options.md#optionssettings + +[detect-ignore]: doc/options.md#optionsdetectignore + +[ignore-name]: doc/options.md#optionsignorename + +[ignore-path]: doc/options.md#optionsignorepath + +[silently-ignore]: doc/options.md#optionssilentlyignore + +[plugin-prefix]: doc/options.md#optionspluginprefix + +[config-transform]: doc/options.md#optionsconfigtransform + +[plugins]: doc/options.md#optionsplugins + +[reporter]: doc/options.md#optionsreporter + +[reporteroptions]: doc/options.md#optionsreporteroptions + +[color]: doc/options.md#optionscolor + +[silent]: doc/options.md#optionssilent + +[quiet]: doc/options.md#optionsquiet + +[frail]: doc/options.md#optionsfrail + +[files]: doc/options.md#optionsfiles + +[configure]: doc/configure.md + +[ignore]: doc/ignore.md + +[plug-ins]: doc/plug-ins.md + +[atom]: https://github.com/unifiedjs/unified-engine-atom + +[gulp]: https://github.com/unifiedjs/unified-engine-gulp + +[args]: https://github.com/unifiedjs/unified-args + +[contribute]: https://github.com/unifiedjs/unified/blob/master/contributing.md + +[coc]: https://github.com/unifiedjs/unified/blob/master/code-of-conduct.md diff --git a/node_modules/unified-lint-rule/index.js b/node_modules/unified-lint-rule/index.js new file mode 100644 index 00000000..fee90b34 --- /dev/null +++ b/node_modules/unified-lint-rule/index.js @@ -0,0 +1,116 @@ +'use strict' + +var wrapped = require('wrapped') + +module.exports = factory + +function factory(id, rule) { + var parts = id.split(':') + var source = parts[0] + var ruleId = parts[1] + var fn = wrapped(rule) + + /* istanbul ignore if - possibly useful if externalised later. */ + if (!ruleId) { + ruleId = source + source = null + } + + attacher.displayName = id + + return attacher + + function attacher(raw) { + var config = coerce(ruleId, raw) + var severity = config[0] + var options = config[1] + var fatal = severity === 2 + + return severity ? transformer : undefined + + function transformer(tree, file, next) { + var index = file.messages.length + + fn(tree, file, options, done) + + function done(err) { + var messages = file.messages + var message + + // Add the error, if not already properly added. + /* istanbul ignore if - only happens for incorrect plugins */ + if (err && messages.indexOf(err) === -1) { + try { + file.fail(err) + } catch (_) {} + } + + while (index < messages.length) { + message = messages[index] + message.ruleId = ruleId + message.source = source + message.fatal = fatal + + index++ + } + + next() + } + } + } +} + +// Coerce a value to a severity--options tuple. +function coerce(name, value) { + var def = 1 + var result + var level + + /* istanbul ignore if - Handled by unified in v6.0.0 */ + if (typeof value === 'boolean') { + result = [value] + } else if (value == null) { + result = [def] + } else if ( + typeof value === 'object' && + (typeof value[0] === 'number' || + typeof value[0] === 'boolean' || + typeof value[0] === 'string') + ) { + result = value.concat() + } else { + result = [1, value] + } + + level = result[0] + + if (typeof level === 'boolean') { + level = level ? 1 : 0 + } else if (typeof level === 'string') { + if (level === 'off') { + level = 0 + } else if (level === 'on' || level === 'warn') { + level = 1 + } else if (level === 'error') { + level = 2 + } else { + level = 1 + result = [level, result] + } + } + + if (level < 0 || level > 2) { + throw new Error( + 'Incorrect severity `' + + level + + '` for `' + + name + + '`, ' + + 'expected 0, 1, or 2' + ) + } + + result[0] = level + + return result +} diff --git a/node_modules/unified-lint-rule/package.json b/node_modules/unified-lint-rule/package.json new file mode 100644 index 00000000..8c9a6e21 --- /dev/null +++ b/node_modules/unified-lint-rule/package.json @@ -0,0 +1,130 @@ +{ + "_from": "unified-lint-rule@^1.0.0", + "_id": "unified-lint-rule@1.0.6", + "_inBundle": false, + "_integrity": "sha512-YPK15YBFwnsVorDFG/u0cVVQN5G2a3V8zv5/N6KN3TCG+ajKtaALcy7u14DCSrJI+gZeyYquFL9cioJXOGXSvg==", + "_location": "/unified-lint-rule", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unified-lint-rule@^1.0.0", + "name": "unified-lint-rule", + "escapedName": "unified-lint-rule", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-lint-blockquote-indentation", + "/remark-lint-checkbox-character-style", + "/remark-lint-code-block-style", + "/remark-lint-definition-case", + "/remark-lint-definition-spacing", + "/remark-lint-emphasis-marker", + "/remark-lint-fenced-code-flag", + "/remark-lint-fenced-code-marker", + "/remark-lint-file-extension", + "/remark-lint-final-definition", + "/remark-lint-final-newline", + "/remark-lint-hard-break-spaces", + "/remark-lint-heading-increment", + "/remark-lint-heading-style", + "/remark-lint-link-title-style", + "/remark-lint-list-item-bullet-indent", + "/remark-lint-list-item-content-indent", + "/remark-lint-list-item-indent", + "/remark-lint-list-item-spacing", + "/remark-lint-maximum-heading-length", + "/remark-lint-maximum-line-length", + "/remark-lint-no-auto-link-without-protocol", + "/remark-lint-no-blockquote-without-marker", + "/remark-lint-no-consecutive-blank-lines", + "/remark-lint-no-duplicate-definitions", + "/remark-lint-no-duplicate-headings", + "/remark-lint-no-emphasis-as-heading", + "/remark-lint-no-file-name-articles", + "/remark-lint-no-file-name-consecutive-dashes", + "/remark-lint-no-file-name-irregular-characters", + "/remark-lint-no-file-name-mixed-case", + "/remark-lint-no-file-name-outer-dashes", + "/remark-lint-no-heading-content-indent", + "/remark-lint-no-heading-punctuation", + "/remark-lint-no-inline-padding", + "/remark-lint-no-literal-urls", + "/remark-lint-no-multiple-toplevel-headings", + "/remark-lint-no-shell-dollars", + "/remark-lint-no-shortcut-reference-image", + "/remark-lint-no-shortcut-reference-link", + "/remark-lint-no-table-indentation", + "/remark-lint-no-undefined-references", + "/remark-lint-no-unused-definitions", + "/remark-lint-ordered-list-marker-style", + "/remark-lint-ordered-list-marker-value", + "/remark-lint-rule-style", + "/remark-lint-strong-marker", + "/remark-lint-table-cell-padding", + "/remark-lint-table-pipe-alignment", + "/remark-lint-table-pipes", + "/remark-lint-unordered-list-marker-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-blockquote-indentation", + "/remark-preset-lint-markdown-style-guide/remark-lint-code-block-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-emphasis-marker", + "/remark-preset-lint-markdown-style-guide/remark-lint-fenced-code-marker", + "/remark-preset-lint-markdown-style-guide/remark-lint-heading-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-link-title-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-list-item-content-indent", + "/remark-preset-lint-markdown-style-guide/remark-lint-ordered-list-marker-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-rule-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-strong-marker", + "/remark-preset-lint-markdown-style-guide/remark-lint-table-cell-padding", + "/remark-preset-lint-recommended/remark-lint-ordered-list-marker-style" + ], + "_resolved": "https://registry.npmjs.org/unified-lint-rule/-/unified-lint-rule-1.0.6.tgz", + "_shasum": "b4ab801ff93c251faa917a8d1c10241af030de84", + "_spec": "unified-lint-rule@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-blockquote-indentation", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/remarkjs/remark-lint/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "wrapped": "^1.0.1" + }, + "deprecated": false, + "description": "unified plugin to make it a bit easier to create linting rules", + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "unified", + "unified-plugin", + "plugin", + "lint", + "rule" + ], + "license": "MIT", + "name": "unified-lint-rule", + "repository": { + "type": "git", + "url": "https://github.com/remarkjs/remark-lint/tree/main/packages/unified-lint-rule" + }, + "version": "1.0.6", + "xo": false +} diff --git a/node_modules/unified-lint-rule/readme.md b/node_modules/unified-lint-rule/readme.md new file mode 100644 index 00000000..154621b6 --- /dev/null +++ b/node_modules/unified-lint-rule/readme.md @@ -0,0 +1,96 @@ +# unified-lint-rule + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unified**][unified] plugin to make it a bit easier to create linting rules. + +Each rule in [`remark-lint`][lint] uses this project, so see that for examples! + +## Install + +[npm][]: + +```sh +npm install unified-lint-rule +``` + +## Use + +```js +var rule = require('unified-lint-rule') + +module.exports = rule('remark-lint:file-extension', fileExtension) + +function fileExtension(tree, file, option) { + var ext = file.extname + var preferred = typeof option === 'string' ? option : 'md' + + if (ext && ext.slice(1) !== preferred) { + file.message('Incorrect extension: use `' + preferred + '`') + } +} +``` + +## Contribute + +See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg + +[build]: https://travis-ci.org/remarkjs/remark-lint + +[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg + +[coverage]: https://codecov.io/github/remarkjs/remark-lint + +[downloads-badge]: https://img.shields.io/npm/dm/unified-lint-rule.svg + +[downloads]: https://www.npmjs.com/package/unified-lint-rule + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unified-lint-rule.svg + +[size]: https://bundlephobia.com/result?p=unified-lint-rule + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg + +[chat]: https://spectrum.chat/unified/remark + +[npm]: https://docs.npmjs.com/cli/install + +[health]: https://github.com/remarkjs/.github + +[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md + +[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md + +[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md + +[license]: https://github.com/remarkjs/remark-lint/blob/main/license + +[author]: https://wooorm.com + +[unified]: https://github.com/unifiedjs/unified + +[lint]: https://github.com/remarkjs/remark-lint diff --git a/node_modules/unified-message-control/LICENSE b/node_modules/unified-message-control/LICENSE new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/unified-message-control/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/unified-message-control/index.js b/node_modules/unified-message-control/index.js new file mode 100644 index 00000000..704a5b8a --- /dev/null +++ b/node_modules/unified-message-control/index.js @@ -0,0 +1,304 @@ +'use strict' + +var trim = require('trim') +var location = require('vfile-location') +var visit = require('unist-util-visit') + +/* Map of allowed verbs. */ +var ALLOWED_VERBS = { + enable: true, + disable: true, + ignore: true +} + +module.exports = messageControl + +function messageControl(options) { + var name = options && options.name + var marker = options && options.marker + var test = options && options.test + var sources + var known + var reset + var enable + var disable + + if (!name) { + throw new Error('Expected `name` in `options`, got `' + name + '`') + } + + if (!marker) { + throw new Error('Expected `name` in `options`, got `' + name + '`') + } + + if (!test) { + throw new Error('Expected `test` in `options`, got `' + test + '`') + } + + known = options.known + reset = options.reset + enable = options.enable || [] + disable = options.disable || [] + sources = options.source + + if (!sources) { + sources = [name] + } else if (typeof sources === 'string') { + sources = [sources] + } + + return transformer + + function transformer(tree, file) { + var toOffset = location(file).toOffset + var initial = !reset + var gaps = detectGaps(tree, file) + var scope = {} + var globals = [] + + visit(tree, test, visitor) + + file.messages = file.messages.filter(filter) + + function visitor(node, position, parent) { + var mark = marker(node) + var ruleIds + var ruleId + var verb + var index + var length + var next + var pos + var tail + + if (!mark || mark.name !== options.name) { + return + } + + ruleIds = mark.attributes.split(/\s/g) + verb = ruleIds.shift() + next = parent.children[position + 1] + pos = mark.node.position && mark.node.position.start + tail = next && next.position && next.position.end + + if (!verb || !ALLOWED_VERBS[verb] === true) { + file.fail( + 'Unknown keyword `' + + verb + + '`: expected ' + + "`'enable'`, `'disable'`, or `'ignore'`", + mark.node + ) + } + + length = ruleIds.length + index = -1 + + while (++index < length) { + ruleId = ruleIds[index] + + if (isKnown(ruleId, verb, mark.node)) { + toggle(pos, verb === 'enable', ruleId) + + if (verb === 'ignore') { + toggle(tail, true, ruleId) + } + } + } + + /* Apply to all rules. */ + if (!length) { + if (verb === 'ignore') { + toggle(pos, false) + toggle(tail, true) + } else { + toggle(pos, verb === 'enable') + reset = verb !== 'enable' + } + } + } + + function filter(message) { + var gapIndex = gaps.length + var ruleId = message.ruleId + var ranges = scope[ruleId] + var pos + + /* Keep messages from a different source. */ + if (!message.source || sources.indexOf(message.source) === -1) { + return true + } + + /* We only ignore messages if they‘re disabled, + * *not* when they’re not in the document. */ + if (!message.line) { + message.line = 1 + } + + if (!message.column) { + message.column = 1 + } + + /* Check whether the warning is inside a gap. */ + pos = toOffset(message) + + while (gapIndex--) { + if (gaps[gapIndex].start <= pos && gaps[gapIndex].end > pos) { + return false + } + } + + /* Check whether allowed by specific and global states. */ + return check(message, ranges, ruleId) && check(message, globals) + } + + /* Helper to check (and possibly warn) if a ruleId is unknown. */ + function isKnown(ruleId, verb, pos) { + var result = known ? known.indexOf(ruleId) !== -1 : true + + if (!result) { + file.warn('Unknown rule: cannot ' + verb + " `'" + ruleId + "'`", pos) + } + + return result + } + + /* Get the latest state of a rule. When without `ruleId`, gets global state. */ + function getState(ruleId) { + var ranges = ruleId ? scope[ruleId] : globals + + if (ranges && ranges.length !== 0) { + return ranges[ranges.length - 1].state + } + + if (!ruleId) { + return !reset + } + + if (reset) { + return enable.indexOf(ruleId) !== -1 + } + + return disable.indexOf(ruleId) === -1 + } + + /* Handle a rule. */ + function toggle(pos, state, ruleId) { + var markers = ruleId ? scope[ruleId] : globals + var currentState + var previousState + + if (!markers) { + markers = [] + scope[ruleId] = markers + } + + previousState = getState(ruleId) + currentState = state + + if (currentState !== previousState) { + markers.push({state: currentState, position: pos}) + } + + /* Toggle all known rules. */ + if (!ruleId) { + for (ruleId in scope) { + toggle(pos, state, ruleId) + } + } + } + + /* Check all `ranges` for `message`. */ + function check(message, ranges, id) { + /* Check the state at the message's position. */ + var index = ranges && ranges.length + var length = -1 + var range + + while (--index > length) { + range = ranges[index] + + /* istanbul ignore if - generated marker. */ + if (!range.position || !range.position.line || !range.position.column) { + continue + } + + if ( + range.position.line < message.line || + (range.position.line === message.line && + range.position.column < message.column) + ) { + return range.state === true + } + } + + /* The first marker ocurred after the first + * message, so we check the initial state. */ + if (!id) { + return initial || reset + } + + return reset ? enable.indexOf(id) !== -1 : disable.indexOf(id) === -1 + } + } +} + +/* Detect gaps in `ast`. */ +function detectGaps(tree, file) { + var lastNode = tree.children[tree.children.length - 1] + var offset = 0 + var isGap = false + var gaps = [] + + /* Find all gaps. */ + visit(tree, one) + + /* Get the end of the document. + * This detects if the last node was the last node. + * If not, there’s an extra gap between the last node + * and the end of the document. */ + if ( + lastNode && + lastNode.position && + lastNode.position.end && + offset === lastNode.position.end.offset && + trim(file.toString().slice(offset)) !== '' + ) { + update() + + update( + tree && tree.position && tree.position.end && tree.position.end.offset - 1 + ) + } + + return gaps + + function one(node) { + var pos = node.position + + update(pos && pos.start && pos.start.offset) + + if (!node.children) { + update(pos && pos.end && pos.end.offset) + } + } + + /* Detect a new position. */ + function update(latest) { + if (latest === null || latest === undefined) { + isGap = true + return + } + + if (offset >= latest) { + return + } + + if (isGap) { + gaps.push({start: offset, end: latest}) + isGap = false + } + + offset = latest + } +} diff --git a/node_modules/unified-message-control/package.json b/node_modules/unified-message-control/package.json new file mode 100644 index 00000000..972cbd30 --- /dev/null +++ b/node_modules/unified-message-control/package.json @@ -0,0 +1,119 @@ +{ + "_from": "unified-message-control@^1.0.0", + "_id": "unified-message-control@1.0.4", + "_inBundle": false, + "_integrity": "sha512-e1dEtN4Z/TvLn/qHm+xeZpzqhJTtfZusFErk336kkZVpqrJYiV9ptxq+SbRPFMlN0OkjDYHmVJ929KYjsMTo3g==", + "_location": "/unified-message-control", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unified-message-control@^1.0.0", + "name": "unified-message-control", + "escapedName": "unified-message-control", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/remark-message-control" + ], + "_resolved": "https://registry.npmjs.org/unified-message-control/-/unified-message-control-1.0.4.tgz", + "_shasum": "a5e02c07112f78c6687b83a10392c2fba86dc09b", + "_spec": "unified-message-control@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-message-control", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/unifiedjs/unified-message-control/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + { + "name": "Christian Murphy", + "email": "christian.murphy.42@gmail.com", + "url": "https://github.com/ChristianMurphy" + } + ], + "dependencies": { + "trim": "0.0.1", + "unist-util-visit": "^1.0.0", + "vfile-location": "^2.0.0" + }, + "deprecated": false, + "description": "Enable, disable, and ignore messages from unified processors", + "devDependencies": { + "browserify": "^16.0.0", + "esmangle": "^1.0.0", + "mdast-comment-marker": "^1.0.2", + "nyc": "^11.0.0", + "prettier": "^1.12.1", + "remark": "^9.0.0", + "remark-cli": "^5.0.0", + "remark-preset-wooorm": "^4.0.0", + "remark-toc": "^5.0.0", + "tape": "^4.0.0", + "xo": "^0.21.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/unifiedjs/unified-message-control#readme", + "keywords": [ + "unified", + "comment", + "message", + "marker", + "control" + ], + "license": "MIT", + "name": "unified-message-control", + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/unifiedjs/unified-message-control.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js --bare -s unifiedMessageControl > unified-message-control.js", + "build-mangle": "esmangle unified-message-control.js > unified-message-control.min.js", + "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.0.4", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "no-var": "off", + "prefer-arrow-callback": "off", + "object-shorthand": "off", + "guard-for-in": "off" + }, + "ignores": [ + "unified-message-control.js" + ] + } +} diff --git a/node_modules/unified-message-control/readme.md b/node_modules/unified-message-control/readme.md new file mode 100644 index 00000000..598d2b91 --- /dev/null +++ b/node_modules/unified-message-control/readme.md @@ -0,0 +1,205 @@ +# unified-message-control [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] + +Enable, disable, and ignore messages with [**unified**][unified]. + +## Installation + +[npm][]: + +```bash +npm install unified-message-control +``` + +## Usage + +Say we have the following file, `example.md`: + +```markdown + + +## Heading +``` + +And our script, `example.js`, looks as follows: + +```javascript +var vfile = require('to-vfile') +var report = require('vfile-reporter') +var remark = require('remark') +var control = require('unified-message-control') +var mdastMarker = require('mdast-comment-marker') + +remark() + .use(warn) + .use(control, {name: 'foo', marker: mdastMarker, test: 'html'}) + .process(vfile.readSync('example.md'), function(err, file) { + console.error(report(err || file)) + }) + +function warn() { + return function(tree, file) { + file.message('Whoops!', tree.children[1], 'foo:thing') + } +} +``` + +Now, running `node example` yields: + +```markdown +example.md: no issues found +``` + +## API + +### `unified.use(control, options)` + +Let comment markers control messages from a certain sources. + +##### Options + +###### `options.name` + +`string` — Name of markers that can control the message sources. + +For example, `{name: 'alpha'}` controls `alpha` markers: + +```markdown + +``` + +###### `options.marker` + +`function` — function that returns a [comment marker object][marker] +for a matched comment, and `null` for a non-matched comment. + +###### `options.test` + +(`Function`, `string`, `Object`, or `Array.`) +— When `string`, works like passing `function (node) {return +node.type === test}`. +When `array`, checks any one of the subtests pass. +When `object`, checks that all keys in `test` are in `node`, +and that they have (strictly) equal values + +###### `options.known` + +`Array.`, optional — List of allowed `ruleId`s. When given, a warning +is shown when someone tries to control an unknown rule. + +For example, `{name: 'alpha', known: ['bravo']}` results in a warning if +`charlie` is configured: + +```markdown + +``` + +###### `options.reset` + +`boolean`, default: `false` — Whether to treat all messages as turned off +initially. + +###### `options.enable` + +`Array.`, optional — List of allowed `ruleId`s used when `reset: true` +to initially turn on. By default (`reset: false`), all rules are turned on. + +###### `options.disable` + +`Array.`, optional — List of disallowed `ruleId`s used when +`reset: false` to initially turn off. + +###### `options.sources` + +`string` or `Array.`, optional — One or more sources which markers by +the specified `name` can control. Defaults to `options.name`. + +### Markers + +###### `disable` + +The **disable** marker turns off all messages of the given rule +identifiers. When without identifiers, all messages are turned +off. + +For example, to turn off certain messages: + +```md + + +* **foo** + +A paragraph, and now another list. + + * __bar__ +``` + +###### `enable` + +The **enable** marker turns on all messages of the given rule +identifiers. When without identifiers, all messages are turned +on. + +For example, to enable certain messages: + +```md + + +**foo** and __bar__. +``` + +###### `ignore` + +The **ignore** marker turns off all messages of the given rule +identifiers occurring in the following node. When without +identifiers, all messages are turned off. + +After the end of the following node, messages are allowed again. + +For example, to turn off certain messages for the next node: + +```md + + +* **foo** + * __bar__ +``` + +## Contribute + +See [`contributing.md` in `unified/unified`][contributing] for ways to get +started. + +This organisation has a [Code of Conduct][coc]. By interacting with this +repository, organisation, or community you agree to abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/unifiedjs/unified-message-control.svg + +[build-status]: https://travis-ci.org/unifiedjs/unified-message-control + +[coverage-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified-message-control.svg + +[coverage-status]: https://codecov.io/github/unifiedjs/unified-message-control + +[chat-badge]: https://img.shields.io/gitter/room/unifiedjs/Lobby.svg + +[chat]: https://gitter.im/unifiedjs/Lobby + +[license]: LICENSE + +[author]: http://wooorm.com + +[npm]: https://docs.npmjs.com/cli/install + +[marker]: https://github.com/syntax-tree/mdast-comment-marker#marker + +[unified]: https://github.com/unifiedjs/unified + +[contributing]: https://github.com/unifiedjs/unified/blob/master/contributing.md + +[coc]: https://github.com/unifiedjs/unified/blob/master/code-of-conduct.md diff --git a/node_modules/unified/LICENSE b/node_modules/unified/LICENSE new file mode 100644 index 00000000..f3722d94 --- /dev/null +++ b/node_modules/unified/LICENSE @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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/unified/index.js b/node_modules/unified/index.js new file mode 100644 index 00000000..b8f9011d --- /dev/null +++ b/node_modules/unified/index.js @@ -0,0 +1,466 @@ +'use strict' + +/* Dependencies. */ +var extend = require('extend') +var bail = require('bail') +var vfile = require('vfile') +var trough = require('trough') +var string = require('x-is-string') +var plain = require('is-plain-obj') + +/* Expose a frozen processor. */ +module.exports = unified().freeze() + +var slice = [].slice +var own = {}.hasOwnProperty + +/* Process pipeline. */ +var pipeline = trough() + .use(pipelineParse) + .use(pipelineRun) + .use(pipelineStringify) + +function pipelineParse(p, ctx) { + ctx.tree = p.parse(ctx.file) +} + +function pipelineRun(p, ctx, next) { + p.run(ctx.tree, ctx.file, done) + + function done(err, tree, file) { + if (err) { + next(err) + } else { + ctx.tree = tree + ctx.file = file + next() + } + } +} + +function pipelineStringify(p, ctx) { + ctx.file.contents = p.stringify(ctx.tree, ctx.file) +} + +/* Function to create the first processor. */ +function unified() { + var attachers = [] + var transformers = trough() + var namespace = {} + var frozen = false + var freezeIndex = -1 + + /* Data management. */ + processor.data = data + + /* Lock. */ + processor.freeze = freeze + + /* Plug-ins. */ + processor.attachers = attachers + processor.use = use + + /* API. */ + processor.parse = parse + processor.stringify = stringify + processor.run = run + processor.runSync = runSync + processor.process = process + processor.processSync = processSync + + /* Expose. */ + return processor + + /* Create a new processor based on the processor + * in the current scope. */ + function processor() { + var destination = unified() + var length = attachers.length + var index = -1 + + while (++index < length) { + destination.use.apply(null, attachers[index]) + } + + destination.data(extend(true, {}, namespace)) + + return destination + } + + /* Freeze: used to signal a processor that has finished + * configuration. + * + * For example, take unified itself. It’s frozen. + * Plug-ins should not be added to it. Rather, it should + * be extended, by invoking it, before modifying it. + * + * In essence, always invoke this when exporting a + * processor. */ + function freeze() { + var values + var plugin + var options + var transformer + + if (frozen) { + return processor + } + + while (++freezeIndex < attachers.length) { + values = attachers[freezeIndex] + plugin = values[0] + options = values[1] + transformer = null + + if (options === false) { + continue + } + + if (options === true) { + values[1] = undefined + } + + transformer = plugin.apply(processor, values.slice(1)) + + if (typeof transformer === 'function') { + transformers.use(transformer) + } + } + + frozen = true + freezeIndex = Infinity + + return processor + } + + /* Data management. + * Getter / setter for processor-specific informtion. */ + function data(key, value) { + if (string(key)) { + /* Set `key`. */ + if (arguments.length === 2) { + assertUnfrozen('data', frozen) + + namespace[key] = value + + return processor + } + + /* Get `key`. */ + return (own.call(namespace, key) && namespace[key]) || null + } + + /* Set space. */ + if (key) { + assertUnfrozen('data', frozen) + namespace = key + return processor + } + + /* Get space. */ + return namespace + } + + /* Plug-in management. + * + * Pass it: + * * an attacher and options, + * * a preset, + * * a list of presets, attachers, and arguments (list + * of attachers and options). */ + function use(value) { + var settings + + assertUnfrozen('use', frozen) + + if (value === null || value === undefined) { + /* Empty */ + } else if (typeof value === 'function') { + addPlugin.apply(null, arguments) + } else if (typeof value === 'object') { + if ('length' in value) { + addList(value) + } else { + addPreset(value) + } + } else { + throw new Error('Expected usable value, not `' + value + '`') + } + + if (settings) { + namespace.settings = extend(namespace.settings || {}, settings) + } + + return processor + + function addPreset(result) { + addList(result.plugins) + + if (result.settings) { + settings = extend(settings || {}, result.settings) + } + } + + function add(value) { + if (typeof value === 'function') { + addPlugin(value) + } else if (typeof value === 'object') { + if ('length' in value) { + addPlugin.apply(null, value) + } else { + addPreset(value) + } + } else { + throw new Error('Expected usable value, not `' + value + '`') + } + } + + function addList(plugins) { + var length + var index + + if (plugins === null || plugins === undefined) { + /* Empty */ + } else if (typeof plugins === 'object' && 'length' in plugins) { + length = plugins.length + index = -1 + + while (++index < length) { + add(plugins[index]) + } + } else { + throw new Error('Expected a list of plugins, not `' + plugins + '`') + } + } + + function addPlugin(plugin, value) { + var entry = find(plugin) + + if (entry) { + if (plain(entry[1]) && plain(value)) { + value = extend(entry[1], value) + } + + entry[1] = value + } else { + attachers.push(slice.call(arguments)) + } + } + } + + function find(plugin) { + var length = attachers.length + var index = -1 + var entry + + while (++index < length) { + entry = attachers[index] + + if (entry[0] === plugin) { + return entry + } + } + } + + /* Parse a file (in string or VFile representation) + * into a Unist node using the `Parser` on the + * processor. */ + function parse(doc) { + var file = vfile(doc) + var Parser + + freeze() + Parser = processor.Parser + assertParser('parse', Parser) + + if (newable(Parser)) { + return new Parser(String(file), file).parse() + } + + return Parser(String(file), file) // eslint-disable-line new-cap + } + + /* Run transforms on a Unist node representation of a file + * (in string or VFile representation), async. */ + function run(node, file, cb) { + assertNode(node) + freeze() + + if (!cb && typeof file === 'function') { + cb = file + file = null + } + + if (!cb) { + return new Promise(executor) + } + + executor(null, cb) + + function executor(resolve, reject) { + transformers.run(node, vfile(file), done) + + function done(err, tree, file) { + tree = tree || node + if (err) { + reject(err) + } else if (resolve) { + resolve(tree) + } else { + cb(null, tree, file) + } + } + } + } + + /* Run transforms on a Unist node representation of a file + * (in string or VFile representation), sync. */ + function runSync(node, file) { + var complete = false + var result + + run(node, file, done) + + assertDone('runSync', 'run', complete) + + return result + + function done(err, tree) { + complete = true + bail(err) + result = tree + } + } + + /* Stringify a Unist node representation of a file + * (in string or VFile representation) into a string + * using the `Compiler` on the processor. */ + function stringify(node, doc) { + var file = vfile(doc) + var Compiler + + freeze() + Compiler = processor.Compiler + assertCompiler('stringify', Compiler) + assertNode(node) + + if (newable(Compiler)) { + return new Compiler(node, file).compile() + } + + return Compiler(node, file) // eslint-disable-line new-cap + } + + /* Parse a file (in string or VFile representation) + * into a Unist node using the `Parser` on the processor, + * then run transforms on that node, and compile the + * resulting node using the `Compiler` on the processor, + * and store that result on the VFile. */ + function process(doc, cb) { + freeze() + assertParser('process', processor.Parser) + assertCompiler('process', processor.Compiler) + + if (!cb) { + return new Promise(executor) + } + + executor(null, cb) + + function executor(resolve, reject) { + var file = vfile(doc) + + pipeline.run(processor, {file: file}, done) + + function done(err) { + if (err) { + reject(err) + } else if (resolve) { + resolve(file) + } else { + cb(null, file) + } + } + } + } + + /* Process the given document (in string or VFile + * representation), sync. */ + function processSync(doc) { + var complete = false + var file + + freeze() + assertParser('processSync', processor.Parser) + assertCompiler('processSync', processor.Compiler) + file = vfile(doc) + + process(file, done) + + assertDone('processSync', 'process', complete) + + return file + + function done(err) { + complete = true + bail(err) + } + } +} + +/* Check if `func` is a constructor. */ +function newable(value) { + return typeof value === 'function' && keys(value.prototype) +} + +/* Check if `value` is an object with keys. */ +function keys(value) { + var key + for (key in value) { + return true + } + return false +} + +/* Assert a parser is available. */ +function assertParser(name, Parser) { + if (typeof Parser !== 'function') { + throw new Error('Cannot `' + name + '` without `Parser`') + } +} + +/* Assert a compiler is available. */ +function assertCompiler(name, Compiler) { + if (typeof Compiler !== 'function') { + throw new Error('Cannot `' + name + '` without `Compiler`') + } +} + +/* Assert the processor is not frozen. */ +function assertUnfrozen(name, frozen) { + if (frozen) { + throw new Error( + [ + 'Cannot invoke `' + name + '` on a frozen processor.\nCreate a new ', + 'processor first, by invoking it: use `processor()` instead of ', + '`processor`.' + ].join('') + ) + } +} + +/* Assert `node` is a Unist node. */ +function assertNode(node) { + if (!node || !string(node.type)) { + throw new Error('Expected node, got `' + node + '`') + } +} + +/* Assert that `complete` is `true`. */ +function assertDone(name, asyncName, complete) { + if (!complete) { + throw new Error( + '`' + name + '` finished async. Use `' + asyncName + '` instead' + ) + } +} diff --git a/node_modules/unified/package.json b/node_modules/unified/package.json new file mode 100644 index 00000000..e9dbfe75 --- /dev/null +++ b/node_modules/unified/package.json @@ -0,0 +1,125 @@ +{ + "_from": "unified@^6.0.0", + "_id": "unified@6.2.0", + "_inBundle": false, + "_integrity": "sha512-1k+KPhlVtqmG99RaTbAv/usu85fcSRu3wY8X+vnsEhIxNP5VbVIDiXnLqyKIG+UMdyTg0ZX9EI6k2AfjJkHPtA==", + "_location": "/unified", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unified@^6.0.0", + "name": "unified", + "escapedName": "unified", + "rawSpec": "^6.0.0", + "saveSpec": null, + "fetchSpec": "^6.0.0" + }, + "_requiredBy": [ + "/remark" + ], + "_resolved": "https://registry.npmjs.org/unified/-/unified-6.2.0.tgz", + "_shasum": "7fbd630f719126d67d40c644b7e3f617035f6dba", + "_spec": "unified@^6.0.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + }, + "bugs": { + "url": "https://github.com/unifiedjs/unified/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "http://wooorm.com" + } + ], + "dependencies": { + "bail": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^1.1.0", + "trough": "^1.0.0", + "vfile": "^2.0.0", + "x-is-string": "^0.1.0" + }, + "deprecated": false, + "description": "Pluggable text processing interface", + "devDependencies": { + "browserify": "^16.0.0", + "esmangle": "^1.0.0", + "nyc": "^11.0.0", + "prettier": "^1.12.1", + "remark-cli": "^5.0.0", + "remark-preset-wooorm": "^4.0.0", + "tape": "^4.4.0", + "xo": "^0.20.0" + }, + "files": [ + "index.js", + "lib" + ], + "homepage": "https://github.com/unifiedjs/unified#readme", + "keywords": [ + "process", + "parse", + "transform", + "compile", + "stringify", + "rehype", + "retext", + "remark" + ], + "license": "MIT", + "name": "unified", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/unifiedjs/unified.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify index.js -s unified > unified.js", + "build-mangle": "esmangle unified.js > unified.min.js", + "format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test" + }, + "version": "6.2.0", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "guard-for-in": "off", + "no-var": "off", + "object-shorthand": "off", + "prefer-arrow-callback": "off", + "unicorn/prefer-type-error": "off" + }, + "ignores": [ + "unified.js" + ] + } +} diff --git a/node_modules/unified/readme.md b/node_modules/unified/readme.md new file mode 100644 index 00000000..e979e0b3 --- /dev/null +++ b/node_modules/unified/readme.md @@ -0,0 +1,993 @@ +# ![unified][logo] + +[![Build Status][travis-badge]][travis] +[![Coverage Status][codecov-badge]][codecov] +[![Chat][chat-badge]][chat] + +**unified** is an interface for processing text using syntax trees. It’s what +powers [**remark**][remark], [**retext**][retext], and [**rehype**][rehype], +but it also allows for processing between multiple syntaxes. + +The website for **unified**, [`unifiedjs.github.io`][site], provides a less +technical and more practical introduction to unified. Make sure to visit it +and try its introductory [Guides][]. + +## Installation + +[npm][]: + +```bash +npm install unified +``` + +## Usage + +```js +var unified = require('unified') +var markdown = require('remark-parse') +var remark2rehype = require('remark-rehype') +var doc = require('rehype-document') +var format = require('rehype-format') +var html = require('rehype-stringify') +var report = require('vfile-reporter') + +unified() + .use(markdown) + .use(remark2rehype) + .use(doc) + .use(format) + .use(html) + .process('# Hello world!', function(err, file) { + console.error(report(err || file)) + console.log(String(file)) + }) +``` + +Yields: + +```html +no issues found + + + + + + + +

Hello world!

+ + +``` + +## Table of Contents + +* [Description](#description) +* [API](#api) + * [processor()](#processor) + * [processor.use(plugin\[, options\])](#processoruseplugin-options) + * [processor.parse(file|value)](#processorparsefilevalue) + * [processor.stringify(node\[, file\])](#processorstringifynode-file) + * [processor.run(node\[, file\]\[, done\])](#processorrunnode-file-done) + * [processor.runSync(node\[, file\])](#processorrunsyncnode-file) + * [processor.process(file|value\[, done\])](#processorprocessfilevalue-done) + * [processor.processSync(file|value)](#processorprocesssyncfilevalue) + * [processor.data(key\[, value\])](#processordatakey-value) + * [processor.freeze()](#processorfreeze) +* [Plugin](#plugin) + * [function attacher(\[options\])](#function-attacheroptions) + * [function transformer(node, file\[, next\])](#function-transformernode-file-next) +* [Preset](#preset) +* [Contribute](#contribute) +* [Acknowledgments](#acknowledgments) +* [License](#license) + +## Description + +**unified** is an interface for processing text using syntax trees. Syntax +trees are a representation understandable to programs. Those programs, called +[**plugin**][plugin]s, take these trees and modify them, amongst other things. +To get to the syntax tree from input text there’s a [**parser**][parser]. To +get from that back to text there’s a [**compiler**][compiler]. This is the +[**process**][process] of a **processor**. + +```ascii +| ....................... process() ......................... | +| ......... parse() ..... | run() | ..... stringify() ....... | + + +--------+ +----------+ +Input ->- | Parser | ->- Syntax Tree ->- | Compiler | ->- Output + +--------+ | +----------+ + X + | + +--------------+ + | Transformers | + +--------------+ +``` + +###### Processors + +Every processor implements another processor. To create a new processor invoke +another processor. This creates a processor that is configured to function the +same as its ancestor. But when the descendant processor is configured in the +future it does not affect the ancestral processor. + +When processors are exposed from a module (for example, unified itself) they +should not be configured directly, as that would change their behaviour for all +module users. Those processors are [**frozen**][freeze] and they should be +invoked to create a new processor before they are used. + +###### Node + +The syntax trees used in **unified** are [**Unist**][unist] nodes: plain +JavaScript objects with a `type` property. The semantics of those `type`s are +defined by other projects. + +There are several [utilities][unist-utilities] for working with these nodes. + +###### List of Processors + +The following projects process different syntax trees. They parse text to +their respective syntax tree and they compile their syntax trees back to text. +These processors can be used as-is, or their parsers and compilers can be mixed +and matched with **unified** and other plugins to process between different +syntaxes. + +* [**rehype**][rehype] ([**HAST**][hast]) — HTML +* [**remark**][remark] ([**MDAST**][mdast]) — Markdown +* [**retext**][retext] ([**NLCST**][nlcst]) — Natural language + +###### List of Plugins + +The below plugins work with **unified**, unrelated to what flavour the syntax +tree is in: + +* [`unified-diff`](https://github.com/unifiedjs/unified-diff) + — Ignore messages for unchanged lines in Travis + +See [**remark**][remark-plugins], [**rehype**][rehype-plugins], and +[**retext**][retext-plugins] for lists of their plugins. + +###### File + +When processing documents metadata is often gathered about that document. +[**VFile**][vfile] is a virtual file format which stores data and handles +metadata and messages for **unified** and its plugins. + +There are several [utilities][vfile-utilities] for working with these files. + +###### Configuration + +To configure a processor invoke its [`use`][use] method, supply it a +[**plugin**][plugin], and optionally settings. + +###### Integrations + +**unified** can integrate with the file-system through +[`unified-engine`][engine]. On top of that, CLI apps can be created with +[`unified-args`][args], Gulp plugins with [`unified-engine-gulp`][gulp], and +Atom Linters with [`unified-engine-atom`][atom]. + +A streaming interface is provided through [`unified-stream`][stream]. + +###### Programming interface + +The API gives access to processing metadata (such as lint messages) and +supports multiple passed through files: + +```js +var unified = require('unified') +var markdown = require('remark-parse') +var styleGuide = require('remark-preset-lint-markdown-style-guide') +var remark2retext = require('remark-retext') +var english = require('retext-english') +var equality = require('retext-equality') +var remark2rehype = require('remark-rehype') +var html = require('rehype-stringify') +var report = require('vfile-reporter') + +unified() + .use(markdown) + .use(styleGuide) + .use( + remark2retext, + unified() + .use(english) + .use(equality) + ) + .use(remark2rehype) + .use(html) + .process('*Emphasis* and _importance_, you guys!', function(err, file) { + console.error(report(err || file)) + console.log(String(file)) + }) +``` + +Yields: + +```txt + 1:16-1:28 warning Emphasis should use `*` as a marker emphasis-marker remark-lint + 1:34-1:38 warning `guys` may be insensitive, use `people`, `persons`, `folks` instead gals-men retext-equality + +⚠ 2 warnings +

Emphasis and importance, you guys!

+``` + +###### Processing between syntaxes + +The processors can be combined in two modes. + +**Bridge** mode transforms the syntax tree from one flavour (the origin) to +another (the destination). Then, transformations are applied on that tree. +Finally, the origin processor continues transforming the original syntax tree. + +**Mutate** mode also transforms the syntax tree from one flavour to another. +But then the origin processor continues transforming the destination syntax +tree. + +In the previous example (“Programming interface”), `remark-retext` is used in +bridge mode: the origin syntax tree is kept after retext is done; whereas +`remark-rehype` is used in mutate mode: it sets a new syntax tree and discards +the original. + +* [`remark-retext`][remark-retext] +* [`remark-rehype`][remark-rehype] +* [`rehype-retext`][rehype-retext] +* [`rehype-remark`][rehype-remark] + +## API + +### `processor()` + +Object describing how to process text. + +###### Returns + +`Function` — New [**unfrozen**][freeze] processor which is configured to +function the same as its ancestor. But when the descendant processor is +configured in the future it does not affect the ancestral processor. + +###### Example + +The following example shows how a new processor can be created (from the remark +processor) and linked to **stdin**(4) and **stdout**(4). + +```js +var remark = require('remark') +var concat = require('concat-stream') + +process.stdin.pipe(concat(onconcat)) + +function onconcat(buf) { + var doc = remark() + .processSync(buf) + .toString() + + process.stdout.write(doc) +} +``` + +### `processor.use(plugin[, options])` + +Configure the processor to use a [**plugin**][plugin] and optionally configure +that plugin with options. + +###### Signatures + +* `processor.use(plugin[, options])` +* `processor.use(preset)` +* `processor.use(list)` + +###### Parameters + +* `plugin` ([`Plugin`][plugin]) +* `options` (`*`, optional) — Configuration for `plugin` +* `preset` (`Object`) — Object with an optional `plugins` (set to `list`), + and/or an optional `settings` object +* `list` (`Array`) — List of plugins, presets, and pairs (`plugin` and + `options` in an array) + +###### Returns + +`processor` — The processor on which `use` is invoked. + +###### Note + +`use` cannot be called on [frozen][freeze] processors. Invoke the processor +first to create a new unfrozen processor. + +###### Example + +There are many ways to pass plugins to `.use()`. The below example gives an +overview. + +```js +var unified = require('unified') + +unified() + // Plugin with options: + .use(plugin, {}) + // Plugins: + .use([plugin, pluginB]) + // Two plugins, the second with options: + .use([plugin, [pluginB, {}]]) + // Preset with plugins and settings: + .use({plugins: [plugin, [pluginB, {}]], settings: {position: false}}) + // Settings only: + .use({settings: {position: false}}) + +function plugin() {} +function pluginB() {} +``` + +### `processor.parse(file|value)` + +Parse text to a syntax tree. + +###### Parameters + +* `file` ([`VFile`][file]) + — Or anything which can be given to `vfile()` + +###### Returns + +[`Node`][node] — Syntax tree representation of input. + +###### Note + +`parse` [freezes][freeze] the processor if not already frozen. + +#### `processor.Parser` + +Function handling the parsing of text to a syntax tree. Used in the +[**parse**][parse] phase in the process and invoked with a `string` and +[`VFile`][file] representation of the document to parse. + +`Parser` can be a normal function in which case it must return a +[`Node`][node]: the syntax tree representation of the given file. + +`Parser` can also be a constructor function (a function with keys in its +`prototype`) in which case it’s invoked with `new`. Instances must have a +`parse` method which is invoked without arguments and must return a +[`Node`][node]. + +### `processor.stringify(node[, file])` + +Compile a syntax tree to text. + +###### Parameters + +* `node` ([`Node`][node]) +* `file` ([`VFile`][file], optional); + — Or anything which can be given to `vfile()` + +###### Returns + +`string` — String representation of the syntax tree file. + +###### Note + +`stringify` [freezes][freeze] the processor if not already frozen. + +#### `processor.Compiler` + +Function handling the compilation of syntax tree to a text. Used in the +[**stringify**][stringify] phase in the process and invoked with a +[`Node`][node] and [`VFile`][file] representation of the document to stringify. + +`Compiler` can be a normal function in which case it must return a `string`: +the text representation of the given syntax tree. + +`Compiler` can also be a constructor function (a function with keys in its +`prototype`) in which case it’s invoked with `new`. Instances must have a +`compile` method which is invoked without arguments and must return a `string`. + +### `processor.run(node[, file][, done])` + +Transform a syntax tree by applying [**plugin**][plugin]s to it. + +###### Parameters + +* `node` ([`Node`][node]) +* `file` ([`VFile`][file], optional) + — Or anything which can be given to `vfile()` +* `done` ([`Function`][run-done], optional) + +###### Returns + +[`Promise`][promise] if `done` is not given. Rejected with an error, or +resolved with the resulting syntax tree. + +###### Note + +`run` [freezes][freeze] the processor if not already frozen. + +##### `function done(err[, node, file])` + +Invoked when transformation is complete. Either invoked with an error or a +syntax tree and a file. + +###### Parameters + +* `err` (`Error`) — Fatal error +* `node` ([`Node`][node]) +* `file` ([`VFile`][file]) + +### `processor.runSync(node[, file])` + +Transform a syntax tree by applying [**plugin**][plugin]s to it. + +If asynchronous [**plugin**][plugin]s are configured an error is thrown. + +###### Parameters + +* `node` ([`Node`][node]) +* `file` ([`VFile`][file], optional) + — Or anything which can be given to `vfile()` + +###### Returns + +[`Node`][node] — The given syntax tree. + +###### Note + +`runSync` [freezes][freeze] the processor if not already frozen. + +### `processor.process(file|value[, done])` + +Process the given representation of a file as configured on the processor. The +process invokes `parse`, `run`, and `stringify` internally. + +###### Parameters + +* `file` ([`VFile`][file]) +* `value` (`string`) — String representation of a file +* `done` ([`Function`][process-done], optional) + +###### Returns + +[`Promise`][promise] if `done` is not given. Rejected with an error or +resolved with the resulting file. + +###### Note + +`process` [freezes][freeze] the processor if not already frozen. + +#### `function done(err, file)` + +Invoked when the process is complete. Invoked with a fatal error, if any, and +the [`VFile`][file]. + +###### Parameters + +* `err` (`Error`, optional) — Fatal error +* `file` ([`VFile`][file]) + +###### Example + +```js +var unified = require('unified') +var markdown = require('remark-parse') +var remark2rehype = require('remark-rehype') +var doc = require('rehype-document') +var format = require('rehype-format') +var html = require('rehype-stringify') + +unified() + .use(markdown) + .use(remark2rehype) + .use(doc) + .use(format) + .use(html) + .process('# Hello world!') + .then( + function(file) { + console.log(String(file)) + }, + function(err) { + console.error(String(err)) + } + ) +``` + +Yields: + +```html + + + + + + + +

Hello world!

+ + +``` + +### `processor.processSync(file|value)` + +Process the given representation of a file as configured on the processor. The +process invokes `parse`, `run`, and `stringify` internally. + +If asynchronous [**plugin**][plugin]s are configured an error is thrown. + +###### Parameters + +* `file` ([`VFile`][file]) +* `value` (`string`) — String representation of a file + +###### Returns + +[`VFile`][file] — Virtual file with modified [`contents`][vfile-contents]. + +###### Note + +`processSync` [freezes][freeze] the processor if not already frozen. + +###### Example + +```js +var unified = require('unified') +var markdown = require('remark-parse') +var remark2rehype = require('remark-rehype') +var doc = require('rehype-document') +var format = require('rehype-format') +var html = require('rehype-stringify') + +var processor = unified() + .use(markdown) + .use(remark2rehype) + .use(doc) + .use(format) + .use(html) + +console.log(processor.processSync('# Hello world!').toString()) +``` + +Yields: + +```html + + + + + + + +

Hello world!

+ + +``` + +### `processor.data(key[, value])` + +Get or set information in an in-memory key-value store accessible to all phases +of the process. An example is a list of HTML elements which are self-closing, +which is needed when parsing, transforming, and compiling HTML. + +###### Parameters + +* `key` (`string`) — Identifier +* `value` (`*`, optional) — Value to set. Omit if getting `key` + +###### Returns + +* `processor` — If setting, the processor on which `data` is invoked +* `*` — If getting, the value at `key` + +###### Note + +Setting information with `data` cannot occur on [frozen][freeze] processors. +Invoke the processor first to create a new unfrozen processor. + +###### Example + +The following example show how to get and set information: + +```js +var unified = require('unified') + +console.log( + unified() + .data('alpha', 'bravo') + .data('alpha') +) +``` + +Yields: + +```txt +bravo +``` + +### `processor.freeze()` + +Freeze a processor. Frozen processors are meant to be extended and not to be +configured or processed directly. + +Once a processor is frozen it cannot be unfrozen. New processors functioning +just like it can be created by invoking the processor. + +It’s possible to freeze processors explicitly, by calling `.freeze()`, but +[`.parse()`][parse], [`.run()`][run], [`.stringify()`][stringify], and +[`.process()`][process] call `.freeze()` to freeze a processor too. + +###### Returns + +`Processor` — The processor on which `freeze` is invoked. + +###### Example + +The following example, `index.js`, shows how [**rehype**][rehype] prevents +extensions to itself: + +```js +var unified = require('unified') +var parse = require('rehype-parse') +var stringify = require('rehype-stringify') + +module.exports = unified() + .use(parse) + .use(stringify) + .freeze() +``` + +The below example, `a.js`, shows how that processor can be used and configured. + +```js +var rehype = require('rehype') +var format = require('rehype-format') +// ... + +rehype() + .use(format) + // ... +``` + +The below example, `b.js`, shows a similar looking example which operates on +the frozen [**rehype**][rehype] interface. If this behaviour was allowed it +would result in unexpected behaviour so an error is thrown. **This is +invalid**: + +```js +var rehype = require('rehype') +var format = require('rehype-format') +// ... + +rehype + .use(format) + // ... +``` + +Yields: + +```txt +~/node_modules/unified/index.js:440 + throw new Error( + ^ + +Error: Cannot invoke `use` on a frozen processor. +Create a new processor first, by invoking it: use `processor()` instead of `processor`. + at assertUnfrozen (~/node_modules/unified/index.js:440:11) + at Function.use (~/node_modules/unified/index.js:172:5) + at Object. (~/b.js:6:4) +``` + +## `Plugin` + +**unified** plugins change the way the applied-on processor works in the +following ways: + +* They modify the [**processor**][processor]: such as changing the parser, + the compiler, or linking it to other processors +* They transform [**syntax tree**][node] representation of files +* They modify metadata of files + +Plugins are a concept. They materialise as [`attacher`][attacher]s. + +###### Example + +`move.js`: + +```js +module.exports = move + +function move(options) { + var expected = (options || {}).extname + + if (!expected) { + throw new Error('Missing `extname` in options') + } + + return transformer + + function transformer(tree, file) { + if (file.extname && file.extname !== expected) { + file.extname = expected + } + } +} +``` + +`index.js`: + +```js +var unified = require('unified') +var parse = require('remark-parse') +var remark2rehype = require('remark-rehype') +var stringify = require('rehype-stringify') +var vfile = require('to-vfile') +var report = require('vfile-reporter') +var move = require('./move') + +unified() + .use(parse) + .use(remark2rehype) + .use(move, {extname: '.html'}) + .use(stringify) + .process(vfile.readSync('index.md'), function(err, file) { + console.error(report(err || file)) + if (file) { + vfile.writeSync(file) // Written to `index.html`. + } + }) +``` + +### `function attacher([options])` + +An attacher is the thing passed to [`use`][use]. It configures the processor +and in turn can receive options. + +Attachers can configure processors, such as by interacting with parsers and +compilers, linking them to other processors, or by specifying how the syntax +tree is handled. + +###### Context + +The context object is set to the invoked on [`processor`][processor]. + +###### Parameters + +* `options` (`*`, optional) — Configuration + +###### Returns + +[`transformer`][transformer] — Optional. + +###### Note + +Attachers are invoked when the processor is [frozen][freeze]: either when +`.freeze()` is called explicitly, or when [`.parse()`][parse], [`.run()`][run], +[`.stringify()`][stringify], or [`.process()`][process] is called for the first +time. + +### `function transformer(node, file[, next])` + +Transformers modify the syntax tree or metadata of a file. A transformer is a +function which is invoked each time a file is passed through the transform +phase. If an error occurs (either because it’s thrown, returned, rejected, or +passed to [`next`][next]), the process stops. + +The transformation process in **unified** is handled by [`trough`][trough], see +it’s documentation for the exact semantics of transformers. + +###### Parameters + +* `node` ([`Node`][node]) +* `file` ([`VFile`][file]) +* `next` ([`Function`][next], optional) + +###### Returns + +* `Error` — Can be returned to stop the process +* [`Node`][node] — Can be returned and results in further transformations + and `stringify`s to be performed on the new tree +* `Promise` — If a promise is returned, the function is asynchronous, and + **must** be resolved (optionally with a [`Node`][node]) or rejected + (optionally with an `Error`) + +#### `function next(err[, tree[, file]])` + +If the signature of a transformer includes `next` (third argument), the +function **may** finish asynchronous, and **must** invoke `next()`. + +###### Parameters + +* `err` (`Error`, optional) — Stop the process +* `node` ([`Node`][node], optional) — New syntax tree +* `file` ([`VFile`][file], optional) — New virtual file + +## `Preset` + +Presets provide a potentially sharable way to configure processors. They can +contain multiple plugins and optionally settings as well. + +###### Example + +`preset.js`: + +```js +exports.settings = {bullet: '*', fences: true} + +exports.plugins = [ + require('remark-preset-lint-recommended'), + require('remark-comment-config'), + require('remark-preset-lint-markdown-style-guide'), + [require('remark-toc'), {maxDepth: 3, tight: true}], + require('remark-github') +] +``` + +`index.js`: + +```js +var remark = require('remark') +var vfile = require('to-vfile') +var report = require('vfile-reporter') +var preset = require('./preset') + +remark() + .use(preset) + .process(vfile.readSync('index.md'), function(err, file) { + console.error(report(err || file)) + + if (file) { + vfile.writeSync(file) + } + }) +``` + +## Contribute + +**unified** is built by people just like you! Check out +[`contributing.md`][contributing] for ways to get started. + +This project has a [Code of Conduct][coc]. By interacting with this repository, +organisation, or community you agree to abide by its terms. + +Want to chat with the community and contributors? Join us in [Gitter][chat]! + +Have an idea for a cool new utility or tool? That’s great! If you want +feedback, help, or just to share it with the world you can do so by creating +an issue in the [`unifiedjs/ideas`][ideas] repository! + +## Acknowledgments + +Preliminary work for unified was done [in 2014][preliminary] for +[**retext**][retext] and inspired by [`ware`][ware]. Further incubation +happened in [**remark**][remark]. The project was finally [externalised][] +in 2015 and [published][] as `unified`. The project was authored by +[**@wooorm**](https://github.com/wooorm). + +Although `unified` since moved it’s plugin architecture to [`trough`][trough], +thanks to [**@calvinfo**](https://github.com/calvinfo), +[**@ianstormtaylor**](https://github.com/ianstormtaylor), and others for their +work on [`ware`][ware], which was a huge initial inspiration. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[logo]: https://cdn.rawgit.com/unifiedjs/unified/0cd3a41/logo.svg + +[travis-badge]: https://img.shields.io/travis/unifiedjs/unified.svg + +[travis]: https://travis-ci.org/unifiedjs/unified + +[codecov-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified.svg + +[codecov]: https://codecov.io/github/unifiedjs/unified + +[chat-badge]: https://img.shields.io/gitter/room/unifiedjs/Lobby.svg + +[chat]: https://gitter.im/unifiedjs/Lobby + +[npm]: https://docs.npmjs.com/cli/install + +[license]: LICENSE + +[author]: http://wooorm.com + +[site]: https://unifiedjs.github.io + +[guides]: https://unifiedjs.github.io/#guides + +[rehype]: https://github.com/rehypejs/rehype + +[remark]: https://github.com/remarkjs/remark + +[retext]: https://github.com/retextjs/retext + +[hast]: https://github.com/syntax-tree/hast + +[mdast]: https://github.com/syntax-tree/mdast + +[nlcst]: https://github.com/syntax-tree/nlcst + +[unist]: https://github.com/syntax-tree/unist + +[engine]: https://github.com/unifiedjs/unified-engine + +[args]: https://github.com/unifiedjs/unified-args + +[gulp]: https://github.com/unifiedjs/unified-engine-gulp + +[atom]: https://github.com/unifiedjs/unified-engine-atom + +[remark-rehype]: https://github.com/remarkjs/remark-rehype + +[remark-retext]: https://github.com/remarkjs/remark-retext + +[rehype-retext]: https://github.com/rehypejs/rehype-retext + +[rehype-remark]: https://github.com/rehypejs/rehype-remark + +[unist-utilities]: https://github.com/syntax-tree/unist#list-of-utilities + +[vfile]: https://github.com/vfile/vfile + +[vfile-contents]: https://github.com/vfile/vfile#vfilecontents + +[vfile-utilities]: https://github.com/vfile/vfile#related-tools + +[file]: #file + +[node]: #node + +[processor]: #processor + +[process]: #processorprocessfilevalue-done + +[parse]: #processorparsefilevalue + +[parser]: #processorparser + +[stringify]: #processorstringifynode-file + +[run]: #processorrunnode-file-done + +[compiler]: #processorcompiler + +[use]: #processoruseplugin-options + +[attacher]: #function-attacheroptions + +[transformer]: #function-transformernode-file-next + +[next]: #function-nexterr-tree-file + +[freeze]: #processorfreeze + +[plugin]: #plugin + +[run-done]: #function-doneerr-node-file + +[process-done]: #function-doneerr-file + +[trough]: https://github.com/wooorm/trough#function-fninput-next + +[promise]: https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/Promise + +[remark-plugins]: https://github.com/remarkjs/remark/blob/master/doc/plugins.md#list-of-plugins + +[rehype-plugins]: https://github.com/rehypejs/rehype/blob/master/doc/plugins.md#list-of-plugins + +[retext-plugins]: https://github.com/retextjs/retext/blob/master/doc/plugins.md#list-of-plugins + +[stream]: https://github.com/unifiedjs/unified-stream + +[contributing]: contributing.md + +[coc]: code-of-conduct.md + +[ideas]: https://github.com/unifiedjs/ideas + +[preliminary]: https://github.com/retextjs/retext/commit/8fcb1f#diff-168726dbe96b3ce427e7fedce31bb0bc + +[externalised]: https://github.com/remarkjs/remark/commit/9892ec#diff-168726dbe96b3ce427e7fedce31bb0bc + +[published]: https://github.com/unifiedjs/unified/commit/2ba1cf + +[ware]: https://github.com/segmentio/ware diff --git a/node_modules/union-value/LICENSE b/node_modules/union-value/LICENSE new file mode 100644 index 00000000..83b56e70 --- /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 00000000..1a90ffbd --- /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 00000000..9c5d8db2 --- /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/package.json b/node_modules/union-value/package.json new file mode 100644 index 00000000..42d2e3da --- /dev/null +++ b/node_modules/union-value/package.json @@ -0,0 +1,101 @@ +{ + "_from": "union-value@^1.0.0", + "_id": "union-value@1.0.1", + "_inBundle": false, + "_integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "_location": "/union-value", + "_phantomChildren": {}, + "_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.1.tgz", + "_shasum": "0b6fe7b835aecda61c6ea4d4f02c14221e109847", + "_spec": "union-value@^1.0.0", + "_where": "/home/remi/github/CPP_BIDS/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": "^2.0.1" + }, + "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.1" +} diff --git a/node_modules/unist-util-generated/index.js b/node_modules/unist-util-generated/index.js new file mode 100644 index 00000000..38eabee7 --- /dev/null +++ b/node_modules/unist-util-generated/index.js @@ -0,0 +1,15 @@ +'use strict' + +module.exports = generated + +function generated(node) { + var position = optional(optional(node).position) + var start = optional(position.start) + var end = optional(position.end) + + return !start.line || !start.column || !end.line || !end.column +} + +function optional(value) { + return value && typeof value === 'object' ? value : {} +} diff --git a/node_modules/unist-util-generated/license b/node_modules/unist-util-generated/license new file mode 100644 index 00000000..8d8660d3 --- /dev/null +++ b/node_modules/unist-util-generated/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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/unist-util-generated/package.json b/node_modules/unist-util-generated/package.json new file mode 100644 index 00000000..7be36e7f --- /dev/null +++ b/node_modules/unist-util-generated/package.json @@ -0,0 +1,166 @@ +{ + "_from": "unist-util-generated@^1.1.0", + "_id": "unist-util-generated@1.1.5", + "_inBundle": false, + "_integrity": "sha512-1TC+NxQa4N9pNdayCYA1EGUOCAO0Le3fVp7Jzns6lnua/mYgwHo0tz5WUAfrdpNch1RZLHc61VZ1SDgrtNXLSw==", + "_location": "/unist-util-generated", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-generated@^1.1.0", + "name": "unist-util-generated", + "escapedName": "unist-util-generated", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/remark-lint-blockquote-indentation", + "/remark-lint-checkbox-character-style", + "/remark-lint-code-block-style", + "/remark-lint-definition-case", + "/remark-lint-definition-spacing", + "/remark-lint-emphasis-marker", + "/remark-lint-fenced-code-flag", + "/remark-lint-fenced-code-marker", + "/remark-lint-final-definition", + "/remark-lint-hard-break-spaces", + "/remark-lint-heading-increment", + "/remark-lint-heading-style", + "/remark-lint-link-title-style", + "/remark-lint-list-item-bullet-indent", + "/remark-lint-list-item-content-indent", + "/remark-lint-list-item-indent", + "/remark-lint-list-item-spacing", + "/remark-lint-maximum-heading-length", + "/remark-lint-maximum-line-length", + "/remark-lint-no-auto-link-without-protocol", + "/remark-lint-no-blockquote-without-marker", + "/remark-lint-no-consecutive-blank-lines", + "/remark-lint-no-duplicate-definitions", + "/remark-lint-no-duplicate-headings", + "/remark-lint-no-emphasis-as-heading", + "/remark-lint-no-heading-content-indent", + "/remark-lint-no-heading-punctuation", + "/remark-lint-no-inline-padding", + "/remark-lint-no-literal-urls", + "/remark-lint-no-multiple-toplevel-headings", + "/remark-lint-no-shell-dollars", + "/remark-lint-no-shortcut-reference-image", + "/remark-lint-no-shortcut-reference-link", + "/remark-lint-no-table-indentation", + "/remark-lint-no-undefined-references", + "/remark-lint-no-unused-definitions", + "/remark-lint-ordered-list-marker-style", + "/remark-lint-ordered-list-marker-value", + "/remark-lint-rule-style", + "/remark-lint-strong-marker", + "/remark-lint-table-cell-padding", + "/remark-lint-table-pipe-alignment", + "/remark-lint-table-pipes", + "/remark-lint-unordered-list-marker-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-blockquote-indentation", + "/remark-preset-lint-markdown-style-guide/remark-lint-code-block-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-emphasis-marker", + "/remark-preset-lint-markdown-style-guide/remark-lint-fenced-code-marker", + "/remark-preset-lint-markdown-style-guide/remark-lint-heading-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-link-title-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-list-item-content-indent", + "/remark-preset-lint-markdown-style-guide/remark-lint-ordered-list-marker-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-rule-style", + "/remark-preset-lint-markdown-style-guide/remark-lint-strong-marker", + "/remark-preset-lint-markdown-style-guide/remark-lint-table-cell-padding", + "/remark-preset-lint-recommended/remark-lint-ordered-list-marker-style" + ], + "_resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.5.tgz", + "_shasum": "1e903e68467931ebfaea386dae9ea253628acd42", + "_spec": "unist-util-generated@^1.1.0", + "_where": "/home/remi/github/CPP_BIDS/node_modules/remark-lint-blockquote-indentation", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-generated/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "deprecated": false, + "description": "Check if a Unist node is generated", + "devDependencies": { + "browserify": "^16.0.0", + "nyc": "^14.0.0", + "prettier": "^1.0.0", + "remark-cli": "^7.0.0", + "remark-preset-wooorm": "^6.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.25.0" + }, + "files": [ + "index.js" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "homepage": "https://github.com/syntax-tree/unist-util-generated#readme", + "keywords": [ + "unist", + "position", + "location", + "generated", + "util", + "utility" + ], + "license": "MIT", + "name": "unist-util-generated", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-generated.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . -s unistUtilGenerated > unist-util-generated.js", + "build-mangle": "browserify . -s unistUtilGenerated -p tinyify > unist-util-generated.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "1.1.5", + "xo": { + "prettier": true, + "esnext": false, + "ignores": [ + "unist-util-generated.js" + ] + } +} diff --git a/node_modules/unist-util-generated/readme.md b/node_modules/unist-util-generated/readme.md new file mode 100644 index 00000000..c364c9c7 --- /dev/null +++ b/node_modules/unist-util-generated/readme.md @@ -0,0 +1,116 @@ +# unist-util-generated + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to check if a [node][] is [*generated*][generated]. + +## Install + +[npm][]: + +```sh +npm install unist-util-generated +``` + +## Usage + +```js +var generated = require('unist-util-generated') + +generated({}) // => true + +generated({position: {start: {}, end: {}}}) // => true + +generated({ + position: {start: {line: 1, column: 1}, end: {line: 1, column: 2}} +}) // => false +``` + +## API + +### `generated(node)` + +Check if [`node`][node] is [*generated*][generated]. + +###### Parameters + +* `node` ([`Node`][node]) — Node to check. + +###### Returns + +`boolean` — Whether `node` is generated. + +## Related + +* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) + — Get the position of nodes +* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) + — Remove `position`s from a tree +* [`unist-util-stringify-position`](https://github.com/syntax-tree/unist-util-stringify-position) + — Stringify a node, position, or point + +## Contribute + +See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [Code of Conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-generated.svg + +[build]: https://travis-ci.org/syntax-tree/unist-util-generated + +[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-generated.svg + +[coverage]: https://codecov.io/github/syntax-tree/unist-util-generated + +[downloads-badge]: https://img.shields.io/npm/dm/unist-util-generated.svg + +[downloads]: https://www.npmjs.com/package/unist-util-generated + +[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-generated.svg + +[size]: https://bundlephobia.com/result?p=unist-util-generated + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg + +[chat]: https://spectrum.chat/unified/syntax-tree + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md + +[support]: https://github.com/syntax-tree/.github/blob/master/support.md + +[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md + +[unist]: https://github.com/syntax-tree/unist + +[node]: https://github.com/syntax-tree/unist#node + +[generated]: https://github.com/syntax-tree/unist#generated diff --git a/node_modules/unist-util-inspect/index.js b/node_modules/unist-util-inspect/index.js new file mode 100644 index 00000000..f49b3bf2 --- /dev/null +++ b/node_modules/unist-util-inspect/index.js @@ -0,0 +1,205 @@ +'use strict' + +var isEmpty = require('is-empty') + +// Detect color support. +var color = true + +try { + color = 'inspect' in require('util') +} catch (error) { + /* istanbul ignore next - browser */ + color = false +} + +module.exports = color ? inspect : /* istanbul ignore next */ noColor + +inspect.color = inspect +noColor.color = inspect +inspect.noColor = noColor +noColor.noColor = noColor + +var dim = ansiColor(2, 22) +var yellow = ansiColor(33, 39) +var green = ansiColor(32, 39) + +// Define ANSII color removal functionality. +var colorExpression = new RegExp( + '(?:' + + '(?:\\u001b\\[)|' + + '\\u009b' + + ')' + + '(?:' + + '(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m]' + + ')|' + + '\\u001b[A-M]', + 'g' +) + +// Standard keys defined by unist: https://github.com/syntax-tree/unist. +// We don’t ignore `data` though. +var ignore = ['type', 'value', 'children', 'position'] + +// Inspects a node, without using color. +function noColor(node, pad) { + return stripColor(inspect(node, pad)) +} + +// Inspects a node. +function inspect(node, pad) { + var result + var children + var index + var length + + if (node && Boolean(node.length) && typeof node !== 'string') { + length = node.length + index = -1 + result = [] + + while (++index < length) { + result[index] = inspect(node[index]) + } + + return result.join('\n') + } + + if (!node || !node.type) { + return String(node) + } + + result = [formatNode(node)] + children = node.children + length = children && children.length + index = -1 + + if (!length) { + return result[0] + } + + if (!pad || typeof pad === 'number') { + pad = '' + } + + while (++index < length) { + node = children[index] + + if (index === length - 1) { + result.push(formatNesting(pad + '└─ ') + inspect(node, pad + ' ')) + } else { + result.push(formatNesting(pad + '├─ ') + inspect(node, pad + '│ ')) + } + } + + return result.join('\n') +} + +// Colored nesting formatter. +function formatNesting(value) { + return dim(value) +} + +// Compile a single position. +function compile(pos) { + var values = [] + + if (!pos) { + return null + } + + values = [[pos.line || 1, pos.column || 1].join(':')] + + if ('offset' in pos) { + values.push(String(pos.offset || 0)) + } + + return values +} + +// Compile a location. +function stringify(start, end) { + var values = [] + var positions = [] + var offsets = [] + + add(start) + add(end) + + if (positions.length !== 0) { + values.push(positions.join('-')) + } + + if (offsets.length !== 0) { + values.push(offsets.join('-')) + } + + return values.join(', ') + + // Add a position. + function add(position) { + var tuple = compile(position) + + if (tuple) { + positions.push(tuple[0]) + + if (tuple[1]) { + offsets.push(tuple[1]) + } + } + } +} + +// Colored node formatter. +function formatNode(node) { + var log = node.type + var location = node.position || {} + var position = stringify(location.start, location.end) + var key + var values = [] + var value + + if (node.children) { + log += dim('[') + yellow(node.children.length) + dim(']') + } else if (typeof node.value === 'string') { + log += dim(': ') + green(JSON.stringify(node.value)) + } + + if (position) { + log += ' (' + position + ')' + } + + for (key in node) { + value = node[key] + + if ( + ignore.indexOf(key) !== -1 || + value === null || + value === undefined || + (typeof value === 'object' && isEmpty(value)) + ) { + continue + } + + values.push('[' + key + '=' + JSON.stringify(value) + ']') + } + + if (values.length !== 0) { + log += ' ' + values.join('') + } + + return log +} + +// Remove ANSI colour from `value`. +function stripColor(value) { + return value.replace(colorExpression, '') +} + +// Factory to wrap values in ANSI colours. +function ansiColor(open, close) { + return color + + function color(value) { + return '\u001B[' + open + 'm' + value + '\u001B[' + close + 'm' + } +} diff --git a/node_modules/unist-util-inspect/license b/node_modules/unist-util-inspect/license new file mode 100644 index 00000000..ce731a9c --- /dev/null +++ b/node_modules/unist-util-inspect/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2015 Titus Wormer + +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/unist-util-inspect/package.json b/node_modules/unist-util-inspect/package.json new file mode 100644 index 00000000..abc88be7 --- /dev/null +++ b/node_modules/unist-util-inspect/package.json @@ -0,0 +1,114 @@ +{ + "_from": "unist-util-inspect@^4.1.2", + "_id": "unist-util-inspect@4.1.4", + "_inBundle": false, + "_integrity": "sha512-7xxyvKiZ1SC9vL5qrMqKub1T31gRHfau4242F69CcaOrXt//5PmRVOmDZ36UAEgiT+tZWzmQmbNZn+mVtnR9HQ==", + "_location": "/unist-util-inspect", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "unist-util-inspect@^4.1.2", + "name": "unist-util-inspect", + "escapedName": "unist-util-inspect", + "rawSpec": "^4.1.2", + "saveSpec": null, + "fetchSpec": "^4.1.2" + }, + "_requiredBy": [ + "/unified-engine" + ], + "_resolved": "https://registry.npmjs.org/unist-util-inspect/-/unist-util-inspect-4.1.4.tgz", + "_shasum": "fefc4794445d0f79bffea7a2421c6f556e73a37c", + "_spec": "unist-util-inspect@^4.1.2", + "_where": "/home/remi/github/CPP_BIDS/node_modules/unified-engine", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "bugs": { + "url": "https://github.com/syntax-tree/unist-util-inspect/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ], + "dependencies": { + "is-empty": "^1.0.0" + }, + "deprecated": false, + "description": "Unist node inspector", + "devDependencies": { + "browserify": "^16.0.0", + "chalk": "^2.3.0", + "nyc": "^14.0.0", + "prettier": "^1.0.0", + "remark-cli": "^6.0.0", + "remark-preset-wooorm": "^5.0.0", + "retext": "^6.0.0", + "strip-ansi": "^5.0.0", + "tape": "^4.0.0", + "tinyify": "^2.0.0", + "xo": "^0.24.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/syntax-tree/unist-util-inspect#readme", + "keywords": [ + "retext", + "remark", + "unist", + "inspect" + ], + "license": "MIT", + "name": "unist-util-inspect", + "nyc": { + "check-coverage": true, + "lines": 100, + "functions": 100, + "branches": 100 + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/syntax-tree/unist-util-inspect.git" + }, + "scripts": { + "build": "npm run build-bundle && npm run build-mangle", + "build-bundle": "browserify . --bare -s unistUtilInspect > unist-util-inspect.js", + "build-mangle": "browserify . --bare -s unistUtilInspect -p tinyify > unist-util-inspect.min.js", + "format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", + "test": "npm run format && npm run build && npm run test-coverage", + "test-api": "node test", + "test-coverage": "nyc --reporter lcov tape test.js" + }, + "version": "4.1.4", + "xo": { + "prettier": true, + "esnext": false, + "rules": { + "guard-for-in": "off" + }, + "ignore": [ + "unist-util-inspect.js" + ] + } +} diff --git a/node_modules/unist-util-inspect/readme.md b/node_modules/unist-util-inspect/readme.md new file mode 100644 index 00000000..a432b9a9 --- /dev/null +++ b/node_modules/unist-util-inspect/readme.md @@ -0,0 +1,128 @@ +# unist-util-inspect + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[**unist**][unist] utility to inspect nodes. + +## Install + +[npm][]: + +```sh +npm install unist-util-inspect +``` + +## Usage + +```js +var u = require('unist-builder') +var inspect = require('unist-util-inspect') + +var tree = u('root', [ + u('literal', '1'), + u('parent', [ + u('void', {id: 'a'}), + u('literal', '2'), + u('node', {id: 'b'}, []) + ]) +]) + +console.log(inspect(tree)) +``` + +Yields: + +```text +root[2] +├─ literal: "1" +└─ parent[3] + ├─ void [id="a"] + ├─ literal: "2" + └─ node[0] [id="b"] +``` + +## API + +### `inspect(node)` + +By default, color support is enabled on Node.js and turned off anywhere else. +See below on how to change that. + +###### Parameters + +* `node` ([`Node`][node]). + +###### Returns + +`string` — String representing `node`. + +### `inspect.